Releases: Starcounter-Jack/JSON-Patch
Allow plain (prototype-less objects) usage
Publish TypeScript definitions in the NPM package
v2.0.2 2.0.2
Add prepublish script in package.json
To make sure JS files are freshly compiled before publishing NPM package.
Better API and cleaner exports
- Include any API function individually by:
import { applyOperation } from 'fast-json-patch'- Remove deprecated
apply, in favour ofapplyPatchandapplyOperation.
Bug fix
Getting root using _get operation in apply function wasn't working.
Such as:
var patches = [{"op":"_get","path":""}]
jsonpatch.apply(doc, patches) // 1.2.0 throws on this callThis was fixed in 1.2.2.
Note: getValueByPointer is part of the API now and _get operation shouldn't be used.
Fix getValueByPointer, validate, copy and _get operations
Deprecate apply, introduce applyOperation, applyPatch and applyReducer
Added:
-
jsonpatch.applyOperation(): Applies single operation object operation on document. -
jsonpatch.applyPatch(): Applies full patch array. -
jsonpatch.applyReducer(): Applies single operation object operation on document. Ideal forpatch.reduce. -
jsonpatch.escapePathComponent(): Escapes json-pointer path component. -
jsonpatch.unescapePathComponent(): Unescapes json-pointer path component. -
jsonpatch.getValueByPointer(): Retrieves a value from a JSON document by a JSON pointer. -
Added
TEST_OPERATION_FAILEDerror, thrown when atestoperation fails.
Deprecated
jsonpatch.apply(): In favor of applyPatch.
Changed
jsonpatch.validate()now accepts a third optional callback parametervalidatorthat you can pass for custom validation.- Now you can opt-out of document mutating behaviour with
applyOperationandapplyPatch. applyOperationandapplyPatchfunctions now returnOperationResultafter applying your operations. It contains each operation result and final document state.- Validation behaviour is now slightly different.
- Enhanced Typescript typings.
A more elaborate explanation is available in README.
Big thanks to @felixfbecker, he had major contributions in every step of this.
Better TS typings and minor fixes
- Better JSDoc comments.
- [TS] Patch operation typings now enforced (commit decebe7).
- [TS] Observer interface implemented (commit decebe7).
- Fixed
hasUndefinedbug #163 (commit 17b141b).
Big thanks to @MRamos62786 & @felixfbecker
npm package update
Publish d.ts file
Publish minified files
1.1.8 Version 1.1.8