interface Parsed<K, V> {
    [NODE_TYPE]: symbol;
    anchor?: string;
    comment?: null | string;
    commentBefore?: null | string;
    flow?: boolean;
    items: Pair<K, V>[];
    range: Range;
    schema: undefined | yaml.Schema;
    spaceBefore?: boolean;
    srcToken?: BlockMap | FlowCollection;
    tag?: string;
    add(pair: Pair<K, V> | {
        key: K;
        value: V;
    }, overwrite?: boolean): void;
    addIn(path: Iterable<unknown>, value: unknown): void;
    clone(schema?: yaml.Schema): Collection;
    delete(key: unknown): boolean;
    deleteIn(path: Iterable<unknown>): boolean;
    get(key: unknown, keepScalar: true): undefined | Scalar<V>;
    get(key: unknown, keepScalar?: false): undefined | V;
    get(key: unknown, keepScalar?: boolean): undefined | V | Scalar<V>;
    getIn(path: Iterable<unknown>, keepScalar?: boolean): unknown;
    has(key: unknown): boolean;
    hasAllNullValues(allowScalar?: boolean): boolean;
    hasIn(path: Iterable<unknown>): boolean;
    set(key: K, value: V): void;
    setIn(path: Iterable<unknown>, value: unknown): void;
    toJSON<T>(_?: unknown, ctx?: ToJSContext, Type?: (new () => T)): any;
    toString(ctx?: StringifyContext, onComment?: (() => void), onChompKeep?: (() => void)): string;
}

Type Parameters

Hierarchy (view full)

Properties

[NODE_TYPE]: symbol
anchor?: string

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

comment?: null | string

A comment on or immediately after this

commentBefore?: null | string

A comment before this

flow?: boolean

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

items: Pair<K, V>[]
range: 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: undefined | yaml.Schema
spaceBefore?: boolean

A blank line before this node and its commentBefore

The CST token that was composed into this node.

tag?: string

A fully qualified tag, if required

Methods

  • Adds a value to the collection.

    Parameters

    • pair: Pair<K, V> | {
          key: K;
          value: V;
      }
    • Optionaloverwrite: boolean

      If not set true, using a key that is already in the collection will throw. Otherwise, overwrites the previous value.

    Returns 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

  • Create a copy of this collection.

    Parameters

    • Optionalschema: yaml.Schema

      If defined, overwrites the original's schema

    Returns Collection

  • Removes a value from the collection.

    Parameters

    • key: unknown

    Returns boolean

    true if the item was found and removed.

  • Removes a value from the collection.

    Parameters

    • path: Iterable<unknown>

    Returns boolean

    true if the item was found and removed.

  • 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

    • key: unknown
    • keepScalar: true

    Returns undefined | Scalar<V>

  • 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

    • key: unknown
    • OptionalkeepScalar: false

    Returns undefined | V

  • 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

    • key: unknown
    • OptionalkeepScalar: boolean

    Returns undefined | V | Scalar<V>

  • 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>
    • OptionalkeepScalar: boolean

    Returns unknown

  • Checks if the collection includes a value with the key key.

    Parameters

    • key: unknown

    Returns boolean

  • Parameters

    • OptionalallowScalar: boolean

    Returns boolean

  • Checks if the collection includes a value with the key key.

    Parameters

    • path: Iterable<unknown>

    Returns boolean

  • Sets a value in this collection. For !!set, value needs to be a boolean to add/remove the item from the set.

    Parameters

    • key: K
    • value: V

    Returns 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

  • Type Parameters

    • T extends MapLike = Map<unknown, unknown>

    Parameters

    • Optional_: unknown
    • Optionalctx: ToJSContext

      Conversion context, originally set in Document#toJS()

    • OptionalType: (new () => T)

      If set, forces the returned collection type

        • new (): T
        • Returns T

    Returns any

    Instance of Type, Map, or Object

  • Parameters

    • Optionalctx: StringifyContext
    • OptionalonComment: (() => void)
        • (): void
        • Returns void

    • OptionalonChompKeep: (() => void)
        • (): void
        • Returns void

    Returns string