v1-compat

Functions

parseAndTransform()

parseAndTransform(text): Document

Parse the given KDL v1 text and turn it into a KDL v2 document

Formatting the given document will result in a KDL v2 text equivalent to the original KDL v1 text.

This function is designed to be used to transform a KDL v1 document into an equivalent KDL v2 document. If that's not the intention, callers are encouraged to use parseWithoutFormatting instead

This function incurs significant overhead, as it loads a parser for KDL v1. This parser is an order of magnitude larger and slower than the v2 parser, so programs implementing compatibility with both KDL v2 and v1 are encouraged to lazy load this compat function only when the KDL document fails to parse as KDL v2.

Parameters

ParameterTypeDescription
textstring | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array

Returns

Document

See

parseWithoutFormatting

Defined in

src/v1-compat.js:349


parseWithoutFormatting()

parseWithoutFormatting(text): Document

Parse the given KDL v1 text as document without storing any formatting information

Formatting the given document will result in a KDL v2 text which represents the same document as the original KDL v1 text but where all comments, whitespace, etc. is removed and standardized. If you want to format the document to transform the given KDL v1 text into KDL v2 text, use parseAndTransform instead.

This function incurs significant overhead, as it loads a parser for KDL v1. This parser is an order of magnitude larger and slower than the v2 parser, so programs implementing compatibility with both KDL v2 and v1 are encouraged to lazy load this compat function only when the KDL document fails to parse as KDL v2.

Parameters

ParameterTypeDescription
textstring | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array

Returns

Document

See

parseAndTransform

Defined in

src/v1-compat.js:313