New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

epsitec-immutablediff

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epsitec-immutablediff

Create RFC 6902 style patches between Immutable.JS data structures

  • 0.5.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
decreased by-25%
Maintainers
3
Weekly downloads
 
Created
Source

Immutable Diff

Create RFC 6902 style patches between Immutable.JS data structures, such as Maps, Lists, and Sets.

Differences from original

Signature of diff function is

function diff(a, b, p, s)

where if s = true, then sequence diffs are ignored and a single block is generated.
This can be usefull as an optimization. If s is a string (identification key of all elements), an additional optimization will be performed, detecting if all elements of a list have changed (in this case a complete change), or just some elements (in this case a granular diff)

Getting Started

Install immutablediff using npm or yarn:

# npm...
npm install --save immutablediff

# ...or yarn
yarn add immutablediff

You can then use it to get the diff ops between you Immutable.JS data structures.

var Immutable = require('immutable');
var diff = require('immutablediff');

var map1 = Immutable.Map({a:1, b:2, c:3});
var map2 = Immutable.Map({a:1, b:2, c:3, d: 4});

diff(map1, map2);
// List [ Map { op: "add", path: "/d", value: 4 } ]

The result of diff is an Immutable Sequence of operations

Immutable Patch

If you want to use the resulting diff to apply patches to other Immutable data structures, you can use the package immutablepatch. Source code available here

Keywords

FAQs

Package last updated on 02 Sep 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc