import { YAML } from "https://deno.land/x/aether@v0.0.3/deps.ts";
const { Composer } = YAML;
Compose a stream of CST nodes into a stream of YAML Documents.
import { Composer, Parser } from 'yaml'
const src: string = ...
const tokens = new Parser().parse(src)
const docs = new Composer().compose(tokens)
Constructors
new
Composer(options?: ParseOptions & DocumentOptions & SchemaOptions)Methods
compose(): Generator<Document.Parsed<import("../nodes/Node.d.ts").ParsedNode>, void, unknown>
tokens: Iterable<Token>,
forceDoc?: boolean,
endOffset?: number,
Compose tokens into documents.
end(forceDoc?: boolean, endOffset?: number): Generator<Document.Parsed<import("../nodes/Node.d.ts").ParsedNode>, void, unknown>
Call at end of input to yield any remaining document.
next(token: Token): Generator<Document.Parsed<import("../nodes/Node.d.ts").ParsedNode>, void, unknown>
Advance the composer by one CST token.
streamInfo(): { comment: string; directives: Directives; errors: YAMLParseError[]; warnings: YAMLWarning[]; }
Current stream status information.
Mostly useful at the end of input for an empty stream.