Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides an interface to specify a path to a key in a document that you can then call a function on to get the value at the specified key as a specific type. You don't create a DocumentPath directly but obtain one via the at() method of Document.

Hierarchy

  • DocumentPath

Index

Properties

Readonly document

document: Document

The document this path belongs to.

Readonly path

path: string

The full document path so far.

Methods

at

  • Returns a new document path instance with the passed in key appended (separated by a dot).

    Parameters

    • keyPathOrIndex: string | number

    Returns DocumentPath

atIndex

  • Returns a new document path instance with the passed in index appended (wrapped by square brackets). Throws if index is less than 0 or not an integer.

    deprecated

    Use at() instead.

    Parameters

    • index: number

    Returns DocumentPath

value

  • value(): any
  • Traverses the document with the key path represented by the receiver and returns the corresponding object or value.

    Returns any