Skip to content

parseDocument

parseDocument(src, _opts?): CompatDocument

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

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