Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • T = unknown

Hierarchy

Index

Constructors

constructor

Properties

[NODE_TYPE]

[NODE_TYPE]: symbol

Optional anchor

anchor?: string

An optional anchor on this node. Used by alias nodes.

Optional comment

comment?: null | string

A comment on or immediately after this

Optional commentBefore

commentBefore?: null | string

A comment before this

Optional flow

flow?: boolean

If true, stringify this and all child nodes using flow rather than block styles.

items

items: Pair<T, null | Scalar<null>>[]

Optional range

range?: null | Range

The [start, value-end, node-end] character offsets for the part of the source parsed into this node (undefined if not parsed). The value-end and node-end positions are themselves not included in their respective ranges.

schema

schema: undefined | yaml.Schema

Optional spaceBefore

spaceBefore?: boolean

A blank line before this node and its commentBefore

Optional srcToken

srcToken?: Token

The CST token that was composed into this node.

Optional tag

tag?: string

A fully qualified tag, if required

Static maxFlowStringSingleLineLength

maxFlowStringSingleLineLength: number

Static tag

tag: string

Accessors

Static tagName

  • get tagName(): "tag:yaml.org,2002:map"
  • Returns "tag:yaml.org,2002:map"

Methods

add

  • add(key: T | Pair<T, null | Scalar<null>> | { key: T; value: null | Scalar<null> }): void
  • Adds a value to the collection.

    Parameters

    Returns void

addIn

  • addIn(path: Iterable<unknown>, value: unknown): void
  • Adds a value to the collection. For !!map and !!omap the value must be a Pair instance or a { key, value } object, which may not have a key that already exists in the map.

    Parameters

    • path: Iterable<unknown>
    • value: unknown

    Returns void

clone

  • Create a copy of this collection.

    Parameters

    • Optional schema: yaml.Schema

      If defined, overwrites the original's schema

    Returns Collection

delete

  • delete(key: unknown): boolean
  • Parameters

    • key: unknown

    Returns boolean

deleteIn

  • deleteIn(path: Iterable<unknown>): boolean
  • Removes a value from the collection.

    Parameters

    • path: Iterable<unknown>

    Returns boolean

    true if the item was found and removed.

get

  • get(key: unknown, keepPair?: boolean): any
  • If keepPair is true, returns the Pair matching key. Otherwise, returns the value of that Pair's key.

    Parameters

    • key: unknown
    • Optional keepPair: boolean

    Returns any

getIn

  • getIn(path: Iterable<unknown>, keepScalar?: boolean): unknown
  • Returns item at key, or undefined if not found. By default unwraps scalar values from their surrounding node; to disable set keepScalar to true (collections are always returned intact).

    Parameters

    • path: Iterable<unknown>
    • Optional keepScalar: boolean

    Returns unknown

has

  • has(key: unknown): boolean
  • Parameters

    • key: unknown

    Returns boolean

hasAllNullValues

  • hasAllNullValues(allowScalar?: boolean): boolean
  • Parameters

    • Optional allowScalar: boolean

    Returns boolean

hasIn

  • hasIn(path: Iterable<unknown>): boolean
  • Checks if the collection includes a value with the key key.

    Parameters

    • path: Iterable<unknown>

    Returns boolean

set

  • set(key: T, value: boolean): void
  • set(key: T, value: null): void
  • deprecated

    Will throw; value must be boolean

    Parameters

    • key: T
    • value: boolean

    Returns void

  • deprecated

    Will throw; value must be boolean

    Parameters

    • key: T
    • value: null

    Returns void

setIn

  • setIn(path: Iterable<unknown>, value: unknown): void
  • Sets a value in this collection. For !!set, value needs to be a boolean to add/remove the item from the set.

    Parameters

    • path: Iterable<unknown>
    • value: unknown

    Returns void

toJSON

  • toJSON(_?: unknown, ctx?: ToJSContext): any
  • Parameters

    • Optional _: unknown
    • Optional ctx: ToJSContext

    Returns any

    Instance of Type, Map, or Object

toString

  • toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string
  • Parameters

    • Optional ctx: StringifyContext
    • Optional onComment: () => void
        • (): void
        • Returns void

    • Optional onChompKeep: () => void
        • (): void
        • Returns void

    Returns string

Generated using TypeDoc