v1-compat

Functions

parse()

parse(text, options?): Document

Defined in: src/v1-compat.js:48

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.

Parameters

ParameterTypeDescription
textstring | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array
options?{ graphemeLocations: boolean; storeLocations: boolean; }
options.graphemeLocations?boolean
options.storeLocations?boolean

Returns

Document


parseAndTransform()

parseAndTransform(text): Document

Defined in: src/v1-compat.js:32

Alias for parse

Parameters

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

Returns

Document

Deprecated

Use parse instead


parseCompat()

parseCompat(text, options?): Document

Defined in: src/v1-compat.js:99

Parse the given KDL v1 or v2 text and return a valid KDL v2 document

Formatting the given document will result in a KDL v2 text, even if the original text was KDL v1.

This function does not respect any /- kdl-version <number> comments in the text. It always tries the most recent KDL version first and falls back to the previous version if that fails. If the text doesn't parse into a valid document under any KDL version, an AggregateError is thrown combining all errors.

Parameters

ParameterTypeDescription
textstring | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array
options?{ graphemeLocations: boolean; storeLocations: boolean; }
options.graphemeLocations?boolean
options.storeLocations?boolean

Returns

Document


parseWithoutFormatting()

parseWithoutFormatting(text): Document

Defined in: src/v1-compat.js:21

Alias for parse

Parameters

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

Returns

Document

Deprecated

Use parse instead