JSPM

immpatch

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 127
  • Score
    100M100P100Q78676F
  • License MIT

Update immutable.js objects using JSON Patch operations

Package Exports

  • immpatch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (immpatch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

immpatch

Build Status coverage dependencies

Update immutable.js objects using JSON Patch operations

Install

$ npm install --save immpatch

Usage

var expect = require('expect.js');
var Immutable = require('immutable');
var patch = require('immpatch');

var object = Immutable.fromJS({ baz: 'qux', foo: 'bar' });

var patched = patch(object, [
  { op: 'replace', path: '/baz', value: 'boo' },
  { op: 'add', path: '/hello', value: ['world'] },
  { op: 'remove', path: '/foo'}
]);

expect(patched.toJS()).to.eql({
  baz: 'boo',
  hello: ['world']
});

For more information about JSON Patch, see:

For a diff / patch generator see immutablediff.

Another similar module is immutablepatch, immpatch is a simpler implementation that uses plain JS objects as patch operations, and has more complete tests with 100% code coverage.

Testing

$ git clone git://github.com/zaim/immpatch
$ npm install
$ npm run test

Test coverage:

$ npm run testcov

Contributing

Use Github issues for bug reports and requests.

Pull requests are actively welcomed.

License

immpatch is MIT licensed.