Skip to content

default

const default: object

Defined in: src/yaml-compat.ts:225

parse: (src, reviverOrOpts?, _opts?) => unknown

Multi-document calibration (checked against real yaml@2.9, not assumed): YAML.parse() on a source with more than one document THROWS — "Source contains multiple documents; please use YAML.parseAllDocuments()" — it does not silently return the first document. Our own parse() (see ./index.ts) also throws on a second document, so this divergence-prone case is naturally aligned with no special-casing needed here.

string

Reviver | Record<string, unknown>

Record<string, unknown>

unknown

parseAllDocuments: (src, _opts?) => CompatDocument[]

Real yaml’s parseAllDocuments never throws — a malformed document’s error is captured in THAT document’s .errors, and documents before/after it still parse independently. Our parseAll (./index.ts) is single-shot and throws on the FIRST error anywhere in the stream, so on failure we can’t recover whichever documents parsed fine before it. Best-effort approximation: report ONE Document carrying the error. Partial fidelity — documented gap, not chased further this milestone.

string

Record<string, unknown>

CompatDocument[]

parseDocument: (src, _opts?) => CompatDocument

Real yaml.parseDocument on multi-document input specifically: it returns the FIRST document’s contents with a “multiple documents” error captured in .errors (non-throwing), rather than rejecting outright. We approximate that one case by falling back to parseAll(src)[0]; any other parse failure yields an empty-contents Document with the error captured — either way parseDocument itself never throws, matching the real contract.

string

Record<string, unknown>

CompatDocument

stringify: (value, _replacerOrOptions?, _options?) => string

unknown

unknown

unknown

string