default
constdefault:object
Defined in: src/yaml-compat.ts:225
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
./index.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>
_opts?
Section titled “_opts?”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 (./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.
Parameters
Section titled “Parameters”string
_opts?
Section titled “_opts?”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 itself never throws, matching the real contract.
Parameters
Section titled “Parameters”string
_opts?
Section titled “_opts?”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