default
constdefault:object
Defined in: src/yaml-compat.ts:337
Type Declaration
Section titled “Type Declaration”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
./core.ts) also throws on a second document, so this divergence-prone case
is naturally aligned with no special-casing needed here.
Parameters
Section titled “Parameters”string
reviverOrOpts?
Section titled “reviverOrOpts?”Reviver | Record<string, unknown> | null
Record<string, unknown>
Returns
Section titled “Returns”unknown
parseAllDocuments
Section titled “parseAllDocuments”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 (./core.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. (An unsupported option,
unlike a parse error, throws up front — see the option rules above.)
Parameters
Section titled “Parameters”string
Record<string, unknown>
Returns
Section titled “Returns”parseDocument
Section titled “parseDocument”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 never throws on a parse error, matching the real
contract. (Like every entry point it still throws up front on an unsupported
option — see the option rules above.)
Parameters
Section titled “Parameters”string
Record<string, unknown>
Returns
Section titled “Returns”stringify
Section titled “stringify”stringify: (
value,replacerOrOptions?,options?) =>string
Parameters
Section titled “Parameters”unknown
replacerOrOptions?
Section titled “replacerOrOptions?”unknown
options?
Section titled “options?”unknown
Returns
Section titled “Returns”string