Skip to main content

Function: resolve()

resolve(pointer, data, fallback?): JSONValue

Defined in: src/pointer/index.ts:34

Resolve JSON Pointer pointer against JSON-like data value.

Parameters​

pointer​

string

A string representation of a JSON pointer.

data​

JSONValue

The target JSON-like value, as you would get from JSON.parse().

fallback?​

JSONValue | typeof UNDEFINED

A default value to return if pointer can not be resolved against data.

Returns​

JSONValue

The value identified by pointer or, if given, the fallback value in the event of a JSONPointerResolutionError.

Throws​

JSONPointerResolutionError If the pointer can not be resolved and no fallback is given.

Throws​

JSONPointerSyntaxError If pointer is malformed according to RFC 6901.