
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
ffc-json-diff
Advanced tools
A diff tool for javascript objects inspired by https://github.com/viruschidai/diff-json.
If a key is specified for an embedded array, the diff will be generated based on the objects have same keys.
var changesets = require('diff-json');
var newObj, oldObj;
oldObj = {
name: 'joe',
age: 55,
coins: [2, 5],
children: [
{name: 'kid1', age: 1},
{name: 'kid2', age: 2}
]};
newObj = {
name: 'smith',
coins: [2, 5, 1],
children: [
{name: 'kid3', age: 3},
{name: 'kid1', age: 0},
{name: 'kid2', age: 2}
]};
# Assume children is an array of child object and the child object has 'name' as its primary key
const diffs = changesets.diff(oldObj, newObj, {children: 'name'});
var changesets = require('diff-json');
var oldObj = {
name: 'joe',
age: 55,
coins: [2, 5],
children: [
{name: 'kid1', age: 1},
{name: 'kid2', age: 2}
]};
# Assume children is an array of child object and the child object has 'name' as its primary key
diffs = [
{
type: 'update', key: 'name', value: 'smith', oldValue: 'joe'
},
{
type: 'update', key: 'coins', embededKey: '$index', changes: [
{type: 'add', key: '2', value: 1 }
]
},
{
type: 'update',
key: 'children',
embededKey: 'name', // The key property name of the elements in an array
changes: [
{
type: 'update', key: 'kid1', changes: [
{type: 'update', key: 'age', value: 0, oldValue: 1 }
]
},
{
type: 'add', key: 'kid3', value: {name: 'kid3', age: 3 }
}
]
},
{
type: 'remove', key: 'age', value: 55
}
]
const result = changesets.applyChanges(oldObj, diffs);
var changesets = require('diff-json');
var newObj = {
name: 'smith',
coins: [2, 5, 1],
children: [
{name: 'kid3', age: 3},
{name: 'kid1', age: 0},
{name: 'kid2', age: 2}
]};
# Assume children is an array of child object and the child object has 'name' as its primary key
diffs = [
{
type: 'update', key: 'name', value: 'smith', oldValue: 'joe'
},
{
type: 'update', key: 'coins', embededKey: '$index', changes: [
{type: 'add', key: '2', value: 1 }
]
},
{
type: 'update',
key: 'children',
embededKey: 'name', // The key property name of the elements in an array
changes: [
{
type: 'update', key: 'kid1', changes: [
{type: 'update', key: 'age', value: 0, oldValue: 1 }
]
},
{
type: 'add', key: 'kid3', value: {name: 'kid3', age: 3 }
}
]
},
{
type: 'remove', key: 'age', value: 55
}
]
const result = changesets.revertChanges(newObj, diffs)
npm install ffc-json-diff
FAQs
https://github.com/feature-flags-co/ffc-json-diff
The npm package ffc-json-diff receives a total of 7 weekly downloads. As such, ffc-json-diff popularity was classified as not popular.
We found that ffc-json-diff 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.