@omnist-dev/omnist
    Preparing search index...

    Class Doc

    A guarded handle on a Document node (a leaf value or an edge list).

    Index
    path: string

    Path string representing the location of this cursor within the document (e.g. "$.user.name").

    • get isLeaf(): boolean

      Returns true if this document cursor points to a scalar leaf node (spec §2.1).

      Returns boolean

    • Append an edge (label, value). A repeated label is how an array grows. Returns this for chaining.

      Parameters

      • label: string
      • value: unknown

      Returns Doc

    • A cursor to the single child under label (editable if internal).

      Parameters

      • label: string

      Returns Doc

    • Returns the number of edges with the specified label.

      Parameters

      • label: string

      Returns number

    • Returns the ordered list of [label, Doc] child edges (spec §2.1). Throws DocumentError if this is a leaf node.

      Returns [string, Doc][]

    • Tests structural equivalence against another Doc or plain JS value (spec §2.3).

      Parameters

      • other: unknown

      Returns boolean

    • Returns all child Doc cursors for edges with the specified label.

      Parameters

      • label: string

      Returns Doc[]

    • Returns the single child Doc cursor for label. Throws DocumentError if there are 0 or >1 matching edges.

      Parameters

      • label: string

      Returns Doc

    • Returns the deduplicated list of child edge labels in first-occurrence order.

      Returns string[]

    • Remove every edge under label.

      Parameters

      • label: string

      Returns Doc

    • Replace all edges under label with a single new edge (positioned at the first old occurrence); set = remove + add.

      Parameters

      • label: string
      • value: unknown

      Returns Doc

    • A JSON-shaped projection: same-label edges grouped into an array.

      A label seen once stays a single value; a label seen more than once becomes an array (the schema-less fallback of the count-1 rule, see docs/design/model.md §9(1)).

      Returns unknown

    • Human-readable string representation of this document node.

      Returns string

    • Build a Doc from a plain JS value.

      Parameters

      • value: unknown

      Returns Doc