Skip to content

parseAll

parseAll(text): unknown[]

Defined in: src/index.ts:548

Parse a multi-document stream into an array of values, one entry per document.

Documents are separated by --- (start) and/or ... (end) markers; a stream with no markers at all is a single (possibly bare) document, same as parse. A source with no documents returns an empty array.

string

The YAML source text, potentially containing multiple documents.

unknown[]

One value per document, in document order.

YAMLParseError if any document in the stream is not well-formed YAML.

parseAll("---\ndish: pancakes\n---\ndish: omelette\n")
// [{ dish: "pancakes" }, { dish: "omelette" }]