Skip to content

parseDocument

parseDocument(src, opts?): CompatDocument

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

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.)

string

Record<string, unknown>

CompatDocument