Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JSONPointerMap

A hierarchical map of JSONPointers.

Hierarchy

  • JSONPointerMap

Index

Properties

root

root: Entry = new Entry(null, ROOT, this)

The root pointer

size

size: number = 0

The number of entries, not counting the root

Methods

contains

  • Check if the map contains value for a given pointer

    Parameters

    Returns boolean

    true if this map has a value for pointer

descendants

  • Get the descendants of a given location.

    The resulting map contains only the path segments of the pointer together with all direct and indirect descendant entries of the pointer's last segment.

    Parameters

    Returns JSONPointerMap

    a pointer map containing only the descendant nodes

get

  • Get the value at a given position

    Parameters

    • pointer: JSONPointer

      the pointer to the location that the value is stored

    Returns any | null

    the element for pointer, or null if there is no value;

getEntry

  • Returns the entry for pointer. Entries reflect the tree structure, and might not have a value.

    Parameters

    • pointer: JSONPointer

      the pointer to the location that the entry is stored

    Returns Entry | null

    the entry for pointer, or null if there is no entry

intersection

  • Get the intersection of the pointer map with a given pointer

    Parameters

    Returns JSONPointerMap

    a pointer map containing only the nodes along the segments specified by the argument

iterator

  • Return a pre-order iterator over the entries

    Returns EntryIterator

    a pre-order EntryIterator over the map's entries

postOrder

  • Return a post-order iterator over the entries

    Returns EntryIterator

    a post-order EntryIterator over the map's entries

put

  • Add an entry.

    By design, no constraints are applied to the supplied pointer. E.g. it is possible to add 'x/foo' followed by 'x/1', even though these cannot be valid paths in a single document. This supports the structural diff use case where we might 'add('x/foo', REMOVE)', then 'add('x/1', INSERT)'.

    Parameters

    • pointer: JSONPointer

      the pointer to the location that the value is stored

    • value: any

      may not be null

    Returns any

    the previous value

toString

  • toString(): string
  • Convert the JSON pointer map to a string

    Returns string

    a string representation of the pointer map