Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding an example #5

Merged
merged 1 commit into from Oct 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 28 additions & 2 deletions README.md
@@ -1,3 +1,29 @@
#Immutable Patch
Immutable Patch
====

Apply RFC 6902 style patches to Immutable.JS data structures, such as `Maps`, `Lists`, and `Sets`.
Apply RFC 6902 style patches to Immutable.JS data structures, such as `Maps`, `Lists`, and `Sets`.

### Getting Started

You may get the module via npm:

```
npm install immutablepatch
```

And apply JSON patches to an immutable JSON object:

```js
var Immutable = require('immutable');
var patch = require('immutablepatch');

var list = Immutable.fromJS([1, 2, [3, 4]]);
var ops = Immutable.fromJS([
{op: 'replace', path: '/2/1', value: 10}
]);

var result = patch(list, ops);
// var expected = Immutable.fromJS([1, 2, [3, 10]]);
```

You will probably need [`immutablediff`](https://github.com/intelie/immutable-js-diff) to generate diff operations.