Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
diff-immutability-helper
Advanced tools
Creates a diff between 2 javascript objects / variables, in a format that is compatible with immutability-helper
Creates a diff between 2 JavaScript objects, allowing you to mutate one object to another using immutability-helper
diff-immutability-helper
creates an immutability-helper compatible diff object between 2 JavaScript variables.
This diff object would then allow you to mutate the base object to the target object.
$ npm install diff-immutability-helper --save
Given:
import diff from 'diff-immutability-helper';
const base = {
a: [1, 2, { b: 1 }, 4, 5, 6],
b: 'test',
c: 'prev'
};
const target = {
a: [1, 2, { b: 2 }, 4, 6],
b: 'test 2',
d: 'new'
};
const change = diff(base, target);
will give a result of:
const change = {
a: {
$splice: [[4, 1], [2, 1, { b: 2 }]]
},
b: {$set: 'test 2'},
$apply: (v) => omit(v, ['c']),
$merge: {
d: 'new'
}
}
thus, we can then do:
import update from 'immutability-helper';
update(base, change); // to match target
diff-immutability-helper
is MIT licensed
FAQs
Creates a diff between 2 javascript objects / variables, in a format that is compatible with immutability-helper
The npm package diff-immutability-helper receives a total of 84 weekly downloads. As such, diff-immutability-helper popularity was classified as not popular.
We found that diff-immutability-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.