(document, operation, index)
| 290 | * @return The updated document |
| 291 | */ |
| 292 | export 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) |
nothing calls this directly
no test coverage detected