MCPcopy Create free account
hub / github.com/Starcounter-Jack/JSON-Patch / getValueByPointer

Function getValueByPointer

commonjs/core.js:87–94  ·  view source on GitHub ↗

* Retrieves a value from a JSON document by a JSON pointer. * Returns the value. * * @param document The document to get the value from * @param pointer an escaped JSON pointer * @return The retrieved value

(document, pointer)

Source from the content-addressed store, hash-verified

85 * @return The retrieved value
86 */
87function getValueByPointer(document, pointer) {
88 if (pointer == '') {
89 return document;
90 }
91 var getOriginalDestination = { op: "_get", path: pointer };
92 applyOperation(document, getOriginalDestination);
93 return getOriginalDestination.value;
94}
95exports.getValueByPointer = getValueByPointer;
96/**
97 * Apply a single JSON Patch Operation on a JSON document.

Callers 2

core.jsFile · 0.70
applyOperationFunction · 0.70

Calls 1

applyOperationFunction · 0.70

Tested by

no test coverage detected