gremlin
    Preparing search index...

    A tree data structure with a tree-shaped public API.

    Children are kept in a private, ordered array of {key, value} entries (not a native Map, whose reference-identity keys would break value-equality). Access is only through the read API; lookups use treeKeysEqual, which compares keys by value and treats null/undefined as a distinct key.

    Index

    Constructors

    Methods

    • Recursively merges other into this tree. For overlapping keys, child subtrees are merged in turn. For keys present only in other, the corresponding subtree reference is adopted directly.

      Parameters

      Returns void

    • Structural recursive equality. Order across siblings is irrelevant; two trees are equal if they have the same set of keys and each key's subtree is recursively equal.

      Parameters

      • other: any

      Returns boolean

    • Returns the keys at the given depth. Depth 0 returns the root keys. Negative depths or depths beyond the tree's height return an empty array.

      Parameters

      • depth: number

      Returns any[]

    • Returns the trees at the given depth. Depth 0 returns a singleton list containing this tree. Negative depths or depths beyond the tree's height return an empty array.

      Parameters

      • depth: number

      Returns Tree[]

    • Produces a formatted string representation of the tree structure using a |-- ASCII style, Uses a |-- ASCII style with a 3-space indent per level and no trailing newline.

      Returns string