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

Function applyReducer

module/core.mjs:292–298  ·  view source on GitHub ↗
(document, operation, index)

Source from the content-addressed store, hash-verified

290 * @return The updated document
291 */
292export function applyReducer(document, operation, index) {
293 var operationResult = applyOperation(document, operation);
294 if (operationResult.test === false) { // failed test
295 throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
296 }
297 return operationResult.newDocument;
298}
299/**
300 * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.
301 * @param {object} operation - operation object (patch)

Callers

nothing calls this directly

Calls 1

applyOperationFunction · 0.70

Tested by

no test coverage detected