Releases: Starcounter-Jack/JSON-Patch
Releases · Starcounter-Jack/JSON-Patch
3.1.1
Bug fixes and ES6 modules
Use ES6 Modules
- package now exports non-bundled ES module #232
main
still points to CommonJS module for backward compatibility- README recommends use of named ES imports
List of changes
v2.2.1...3.0.0-0
Use ES6 Modules
- package now exports non-bundled ES module #232
main
still points to CommonJS module for backward compatibility- README recommends use of named ES imports
Full list of changes
v2.2.1...3.0.0-0
Fix default import
This patch release fixes a regression introduced in 2.2.0, namely: the default import using ES6 with Webpack/Babel stopped working (#233).
This version fixes the problem by adding an explicit default import.
Generate invertible test operations
Enhancements and bug fixes
-
applyOperation
andapplyReducer
now accept an optional index parameter. This param is used to create more elaborate error messages when invalid operations occur in your patches, #221. -
Error messages are now nicely-formatted, they look like:
The specified index MUST NOT be greater than the number of elements in the array
name: OPERATION_VALUE_OUT_OF_BOUNDS
index: 1
operation: {
"op": "add",
"path": "/root/1",
"value": "val"
}
tree: {
"root": []
}"
Use Map and WeakMap to remove leaks and enhance performance
Minor fixes
- Ignore
tsconfig.json
when publishing to NPM 5236d81, thanks @LinusU! - add param
mutateDocument
in functionapplyPatch
that defaults totrue
. If you set it tofalse
, your object will be cloned before applying any operations. 688be37, thanks @chochihim!
Support applying array properties
Earlier, setting array props wasn't possible:
var obj = [];
jsonpatch.applyPatch(obj, [{op: 'add', path: '/prop', value: 'arrayProp'}])
console.log(obj.prop); // --> undefined
Now it is.
Validate patches in applyPatch
- Validate on
applyPatch
when validation is enabled (fix #186)