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

Properties

atDirectives: any
decorate: any
directives: any
doc: any
errors: any
onError: any
options: any
prelude: any
warnings: any

Methods

  • Compose tokens into documents.

    Parameters

    • tokens: Iterable<yaml.CST.Token>
    • Optional forceDoc: boolean

      If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.

    • Optional endOffset: number

      Should be set if forceDoc is also set, to set the document range end and to indicate errors correctly.

    Returns Generator<yaml.Document.Parsed<ParsedNode>, void, unknown>

  • Call at end of input to yield any remaining document.

    Parameters

    • Optional forceDoc: boolean

      If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.

    • Optional endOffset: number

      Should be set if forceDoc is also set, to set the document range end and to indicate errors correctly.

    Returns Generator<yaml.Document.Parsed<ParsedNode>, void, unknown>

  • Current stream status information.

    Mostly useful at the end of input for an empty stream.

    Returns {
        comment: string;
        directives: Directives;
        errors: YAMLParseError[];
        warnings: YAMLWarning[];
    }

Generated using TypeDoc