https://github.com/universaldatatool/seamless-immutable-patch
Execute JSON Patches on seamless-immutable objects
https://github.com/universaldatatool/seamless-immutable-patch
Last synced: about 1 year ago
JSON representation
Execute JSON Patches on seamless-immutable objects
- Host: GitHub
- URL: https://github.com/universaldatatool/seamless-immutable-patch
- Owner: UniversalDataTool
- Created: 2020-10-03T06:55:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-10T02:25:13.000Z (over 5 years ago)
- Last Synced: 2024-10-29T18:45:15.785Z (over 1 year ago)
- Language: JavaScript
- Size: 44.9 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# seamless-immutable-patch
[](https://badge.fury.io/js/seamless-immutable-patch)
[](https://github.com/UniversalDataTool/seamless-immutable-patch/actions)
Execute [JSON Patches](https://tools.ietf.org/html/rfc6902#section-4.5) on [seamless-immutable](https://github.com/rtfeldman/seamless-immutable) objects.
## Installation
`npm install seamless-immutable-patch`
## Usage
```javascript
const immutable = require("seamless-immutable")
const seamlessImmutablePatch = require("seamless-immutable-patch")
const obj = immutable({
a: 1,
b: {
c: 2,
},
})
const patched = seamlessImmutablePatch(obj, [
{
op: "replace",
path: "/b/c",
value: 3,
},
])
/*
> patched
immutable({
a: 1,
b: {
c: 3,
},
})
*/
```