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

3-way-diff

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

3-way-diff - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

14

index.js

@@ -118,5 +118,13 @@ /**

} else {
_.forOwn(array, function (value, key) {
// TODO handle arrays of arrays or objects
});
// Handle arrays
path.push(key);
for (var index in array) {
path.push(index);
var differences = recurse(parentValue[index], theirsValue[index], mineValue[index], path, options[key] || {});
if (differences) {
results = results.concat(differences);
}
path.pop();
}
path.pop();
}

@@ -123,0 +131,0 @@ }

{
"name": "3-way-diff",
"version": "1.0.4",
"version": "1.0.5",
"description": "3-way diffing of JavaScript objects",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -197,4 +197,60 @@ var assert = require('assert');

});
it('both children edit same array item to same array values', function() {
var parent = {
key: [
{childKey1: 'value1'},
{childKey2: 'value2'}
]
};
var theirs = {
key: [
{childKey1: 'value3'},
{childKey2: 'value2'}
]
};
var mine = {
key: [
{childKey1: 'value3'},
{childKey2: 'value2'}
]
};
var expected = [
// No differences
];
assert.deepEqual(diff(parent, theirs, mine), expected);
});
it('both children edit same array item to different array values', function() {
var parent = {
key: [
{childKey1: 'value1'},
{childKey2: 'value2'}
]
};
var theirs = {
key: [
{childKey1: 'value3'},
{childKey2: 'value2'}
]
};
var mine = {
key: [
{childKey1: 'value4'},
{childKey2: 'value2'}
]
};
var expected = [
{
kind: 'C',
path: [ 'key', '0', 'childKey1' ],
parent: parent.key[0].childKey1,
theirs: theirs.key[0].childKey1,
mine: mine.key[0].childKey1
}
];
assert.deepEqual(diff(parent, theirs, mine), expected);
});
});
// TODO These are probably useful tests https://github.com/falsecz/3-way-merge/blob/master/test/test.coffee
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