Socket
Socket
Sign inDemoInstall

immutable-merge-patch

Package Overview
Dependencies
24
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    immutable-merge-patch

An implementation of RFC 7396 for Immutable Maps


Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Install size
957 kB
Created
Weekly downloads
 

Readme

Source

immutable-merge-patch

An implementation of RFC 7396 (JSON Merge Patch) for Immutable.js Maps.

Thoroughly tested with full code coverage using Mocha and Istanbul.

Installation

npm install --save immutable-merge-patch

Usage

var Immutable = require("immutable");
var immutableMergePatch = require("immutable-merge-patch");

var a = Map({
	a: 1,
	b: 2,
	c: 3
});
var b = Map({
	a: 1,
	b: 5,
	c: "some string"
});

var diff = immutableMergePatch.generate(a, b);
// diff = Map { b: 5, c: "some string" }
var c = immutableMergePatch.apply(a, diff);
// c.equals(a) === true

Limitations / features not specified in RFC 7396

  • Non-string keys are currently totally ignored. (Have a reason for this to change? Open an issue and I'll consider it.)
  • The generate function only recurses into Immutable.Map objects, not plain JavaScript objects.
  • If the Maps passed into generate() are OrderedMaps, an OrderedMap is returned, with the keys inheriting their order from the first parameter where possible.

License

immutable-merge-patch is licensed under the MIT License.

P.S. It's also forthebadge. ;)

Keywords

FAQs

Last updated on 24 Aug 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc