Options
All
  • Public
  • Public/Protected
  • All
Menu

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)

Hierarchy

  • Composer

Index

Constructors

constructor

Properties

Private atDirectives

atDirectives: any

Private decorate

decorate: any

Private directives

directives: any

Private doc

doc: any

Private errors

errors: any

Private onError

onError: any

Private options

options: any

Private prelude

prelude: any

Private warnings

warnings: any

Methods

compose

  • Compose tokens into documents.

    Parameters

    • tokens: Iterable<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>

end

  • 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>

next

  • Advance the composer by one CST token.

    Parameters

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

streamInfo

  • 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