* 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)
| 85 | * @return The retrieved value |
| 86 | */ |
| 87 | function 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 | } |
| 95 | exports.getValueByPointer = getValueByPointer; |
| 96 | /** |
| 97 | * Apply a single JSON Patch Operation on a JSON document. |
no test coverage detected