Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object-merge

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-merge - npm Package Compare versions

Comparing version 2.2.3 to 2.3.0

63

browser/object-merge_web.js

@@ -153,29 +153,50 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

}
function main(shadows) {
var out = getOutputObject(shadows);
function shadowHandler(val, prop, shadow) {
// this is the queue of visited objects / properties.
var visited = [];
function objectMergeRecursor(shadows) {
// if any of the current objects to process exist in the queue
// then throw an error.
shadows.forEach(function (item) {
if (item instanceof Object && visited.indexOf(item) > -1) {
throw new Error('Circular reference error');
}
});
// if none of the current objects were in the queue then add references
// to the queue.
visited = visited.concat(shadows);
function main(shadows) {
var out = getOutputObject(shadows);
/*jslint unparam:true */
if (out[prop]) {
out[prop] = objectMerge(out[prop], shadow[prop]);
} else {
out[prop] = objectMerge(shadow[prop]);
function shadowHandler(val, prop, shadow) {
if (out[prop]) {
out[prop] = objectMergeRecursor([
out[prop],
shadow[prop]
]);
} else {
out[prop] = objectMergeRecursor([shadow[prop]]);
}
}
/*jslint unparam:false */
function shadowMerger(shadow) {
objectForeach(shadow, shadowHandler);
}
// short circuits case where output would be a primitive value
// anyway.
if (out instanceof Object) {
// only merges trailing objects since primitives would wipe out
// previous objects, as in merging {a:'a'}, 'a', and {b:'b'}
// would result in {b:'b'} so the first two arguments
// can be ignored completely.
var relevantShadows = getShadowObjects(shadows);
relevantShadows.forEach(shadowMerger);
}
return out;
}
function shadowMerger(shadow) {
objectForeach(shadow, shadowHandler);
}
// short circuits case where output would be a primitive value anyway.
if (out instanceof Object) {
// only merges trailing objects since primitives would wipe out previous
// objects, as in merging {a:'a'}, 'a', and {b:'b'} would result in
// {b:'b'} so the first two arguments can be ignored completely.
var relevantShadows = getShadowObjects(shadows);
relevantShadows.forEach(shadowMerger);
}
return out;
return main(shadows);
}
return main(shadows);
return objectMergeRecursor(shadows);
}
module.exports = objectMerge;
},{"clone-function":2,"object-foreach":3}]},{},[1])
//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlcyI6WyJDOi9Vc2Vycy9rYXN0b3IvRG9jdW1lbnRzL0dpdEh1Yi9vYmplY3QtbWVyZ2UvZGV2L2Jyb3dzZXJNYWluLmpzIiwiQzovVXNlcnMva2FzdG9yL0RvY3VtZW50cy9HaXRIdWIvb2JqZWN0LW1lcmdlL25vZGVfbW9kdWxlcy9jbG9uZS1mdW5jdGlvbi9zcmMvY2xvbmUtZnVuY3Rpb24uanMiLCJDOi9Vc2Vycy9rYXN0b3IvRG9jdW1lbnRzL0dpdEh1Yi9vYmplY3QtbWVyZ2Uvbm9kZV9tb2R1bGVzL29iamVjdC1mb3JlYWNoL3NyYy9vYmplY3QtZm9yZWFjaC5qcyIsIkM6L1VzZXJzL2thc3Rvci9Eb2N1bWVudHMvR2l0SHViL29iamVjdC1tZXJnZS9zcmMvb2JqZWN0LW1lcmdlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBOztBQ0RBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQT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YmplY3QgY29tcG9zZWQgZnJvbSBjbG9uZXMgb2YgdGhlXHJcbiAqICBpbnB1dCBvYmplY3RzLlxyXG4gKiBAZXhhbXBsZVxyXG4gKiAgdmFyIG9iamVjdE1lcmdlID0gcmVxdWlyZSgnb2JqZWN0LW1lcmdlJyk7XHJcbiAqICB2YXIgeCA9IHtcclxuICogICAgICBhIDogJ2EnLFxyXG4gKiAgICAgIGIgOiAnYicsXHJcbiAqICAgICAgYyA6IHtcclxuICogICAgICAgICAgZCA6ICdkJyxcclxuICogICAgICAgICAgZSA6ICdlJyxcclxuICogICAgICAgICAgZiA6IHtcclxuICogICAgICAgICAgICAgIGcgOiAnZydcclxuICogICAgICAgICAgfVxyXG4gKiAgICAgIH1cclxuICogIH07XHJcbiAqICB2YXIgeSA9IHtcclxuICogICAgICBhIDogJ2BhJyxcclxuICogICAgICBiIDogJ2BiJyxcclxuICogICAgICBjIDoge1xyXG4gKiAgICAgICAgICBkIDogJ2BkJ1xyXG4gKiAgICAgIH1cclxuICogIH07XHJcbiAqICB2YXIgeiA9IHtcclxuICogICAgICBhIDoge1xyXG4gKiAgICAgICAgICBiIDogJ2BgYidcclxuICogICAgICB9LFxyXG4gKiAgICAgIGZ1biA6IGZ1bmN0aW9uIGZvbyAoKSB7XHJcbiAqICAgICAgICAgIHJldHVybiAnZm9vJztcclxuICogICAgICB9LFxyXG4gKiAgICAgIGFwcyA6IEFycmF5LnByb3RvdHlwZS5zbGljZVxyXG4gKiAgfTtcclxuICogIHZhciBvdXQgPSBvYmplY3RNZXJnZSh4LCB5LCB6KTtcclxuICogIC8vIG91dC5hIHdpbGwgYmUge1xyXG4gKiAgLy8gICAgICAgICBiIDogJ2BgYidcclxuICogIC8vICAgICB9XHJcbiAqICAvLyBvdXQuYiB3aWxsIGJlICdgYidcclxuICogIC8vIG91dC5jIHdpbGwgYmUge1xyXG4gKiAgLy8gICAgICAgICBkIDogJ2BkJyxcclxuICogIC8vICAgICAgICAgZSA6ICdlJyxcclxuICogIC8vICAgICAgICAgZiA6IHtcclxuICogIC8vICAgICAgICAgICAgIGcgOiAnZydcclxuICogIC8vICAgICAgICAgfVxyXG4gKiAgLy8gICAgIH1cclxuICogIC8vIG91dC5mdW4gd2lsbCBiZSBhIGNsb25lIG9mIHouZnVuXHJcbiAqICAvLyBvdXQuYXBzIHdpbGwgYmUgZXF1YWwgdG8gei5hcHNcclxuICovXHJcbmZ1bmN0aW9uIG9iamVjdE1lcmdlKHNoYWRvd3MpIHtcclxuICAgICd1c2Ugc3RyaWN0JztcclxuICAgIHZhciBvYmplY3RGb3JlYWNoID0gcmVxdWlyZSgnb2JqZWN0LWZvcmVhY2gnKTtcclxuICAgIHZhciBjbG9uZUZ1bmN0aW9uID0gcmVxdWlyZSgnY2xvbmUtZnVuY3Rpb24nKTtcclxuICAgIHNoYWRvd3MgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApO1xyXG4gICAgLy8gZ2V0cyB0aGUgc2VxdWVudGlhbCB0cmFpbGluZyBvYmplY3RzIGZyb20gYXJyYXkuXHJcbiAgICBmdW5jdGlvbiBnZXRTaGFkb3dPYmplY3RzKHNoYWRvd3MpIHtcclxuICAgICAgICB2YXIgb3V0ID0gc2hhZG93cy5yZWR1Y2UoZnVuY3Rpb24gKGNvbGxlY3Rvciwgc2hhZG93KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2hhZG93IGluc3RhbmNlb2YgT2JqZWN0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29sbGVjdG9yLnB1c2goc2hhZG93KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29sbGVjdG9yID0gW107XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gY29sbGVjdG9yO1xyXG4gICAgICAgICAgICB9LCBbXSk7XHJcbiAgICAgICAgcmV0dXJuIG91dDtcclxuICAgIH1cclxuICAg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fSBSZXR1cm5zIGEgc2luZ2xlIG1lcmdlZCBvYmplY3QgY29tcG9zZWQgZnJvbSBjbG9uZXMgb2YgdGhlXHJcbiAqICBpbnB1dCBvYmplY3RzLlxyXG4gKiBAZXhhbXBsZVxyXG4gKiAgdmFyIG9iamVjdE1lcmdlID0gcmVxdWlyZSgnb2JqZWN0LW1lcmdlJyk7XHJcbiAqICB2YXIgeCA9IHtcclxuICogICAgICBhIDogJ2EnLFxyXG4gKiAgICAgIGIgOiAnYicsXHJcbiAqICAgICAgYyA6IHtcclxuICogICAgICAgICAgZCA6ICdkJyxcclxuICogICAgICAgICAgZSA6ICdlJyxcclxuICogICAgICAgICAgZiA6IHtcclxuICogICAgICAgICAgICAgIGcgOiAnZydcclxuICogICAgICAgICAgfVxyXG4gKiAgICAgIH1cclxuICogIH07XHJcbiAqICB2YXIgeSA9IHtcclxuICogICAgICBhIDogJ2BhJyxcclxuICogICAgICBiIDogJ2BiJyxcclxuICogICAgICBjIDoge1xyXG4gKiAgICAgICAgICBkIDogJ2BkJ1xyXG4gKiAgICAgIH1cclxuICogIH07XHJcbiAqICB2YXIgeiA9IHtcclxuICogICAgICBhIDoge1xyXG4gKiAgICAgICAgICBiIDogJ2BgYidcclxuICogICAgICB9LFxyXG4gKiAgICAgIGZ1biA6IGZ1bmN0aW9uIGZvbyAoKSB7XHJcbiAqICAgICAgICAgIHJldHVybiAnZm9vJztcclxuICogICAgICB9LFxyXG4gKiAgICAgIGFwcyA6IEFycmF5LnByb3RvdHlwZS5zbGljZVxyXG4gKiAgfTtcclxuICogIHZhciBvdXQgPSBvYmplY3RNZXJnZSh4LCB5LCB6KTtcclxuICogIC8vIG91dC5hIHdpbGwgYmUge1xyXG4gKiAgLy8gICAgICAgICBiIDogJ2BgYidcclxuICogIC8vICAgICB9XHJcbiAqICAvLyBvdXQuYiB3aWxsIGJlICdgYidcclxuICogIC8vIG91dC5jIHdpbGwgYmUge1xyXG4gKiAgLy8gICAgICAgICBkIDogJ2BkJyxcclxuICogIC8vICAgICAgICAgZSA6ICdlJyxcclxuICogIC8vICAgICAgICAgZiA6IHtcclxuICogIC8vICAgICAgICAgICAgIGcgOiAnZydcclxuICogIC8vICAgICAgICAgfVxyXG4gKiAgLy8gICAgIH1cclxuICogIC8vIG91dC5mdW4gd2lsbCBiZSBhIGNsb25lIG9mIHouZnVuXHJcbiAqICAvLyBvdXQuYXBzIHdpbGwgYmUgZXF1YWwgdG8gei5hcHNcclxuICovXHJcbmZ1bmN0aW9uIG9iamVjdE1lcmdlKHNoYWRvd3MpIHtcclxuICAgICd1c2Ugc3RyaWN0JztcclxuICAgIHZhciBvYmplY3RGb3JlYWNoID0gcmVxdWlyZSgnb2JqZWN0LWZvcmVhY2gnKTtcclxuICAgIHZhciBjbG9uZUZ1bmN0aW9uID0gcmVxdWlyZSgnY2xvbmUtZnVuY3Rpb24nKTtcclxuICAgIHNoYWRvd3MgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApO1xyXG4gICAgLy8gZ2V0cyB0aGUgc2VxdWVudGlhbCB0cmFpbGluZyBvYmplY3RzIGZyb20gYXJyYXkuXHJcbiAgICBmdW5jdGlvbiBnZXRTaGFkb3dPYmplY3RzKHNoYWRvd3MpIHtcclxuICAgICAgICB2YXIgb3V0ID0gc2hhZG93cy5yZWR1Y2UoZnVuY3Rpb24gKGNvbGxlY3Rvciwgc2hhZG93KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2hhZG93IGluc3RhbmNlb2YgT2JqZWN0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29sbGVjdG9yLnB1c2goc2hhZG93KTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY29sbGVjdG9yID0gW107XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gY29sbGVjdG9yO1xyXG4gICAgICAgICAgICB9LCBbXSk7XHJcbiAgIC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xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzaGFkb3dbcHJvcF1cclxuICAgICAgICAgICAgICAgICAgICBdKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgb3V0W3Byb3BdID0gb2JqZWN0TWVyZ2VSZWN1cnNvcihbc2hhZG93W3Byb3BdXSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgLypqc2xpbnQgdW5wYXJhbTpmYWxzZSAqL1xyXG4gICAgICAgICAgICBmdW5jdGlvbiBzaGFkb3dNZXJnZXIoc2hhZG93KSB7XHJcbiAgICAgICAgICAgICAgICBvYmplY3RGb3JlYWNoKHNoYWRvdywgc2hhZG93SGFuZGxlcik7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgLy8gc2hvcnQgY2lyY3VpdHMgY2FzZSB3aGVyZSBvdXRwdXQgd291bGQgYmUgYSBwcmltaXRpdmUgdmFsdWVcclxuICAgICAgICAgICAgLy8gYW55d2F5LlxyXG4gICAgICAgICAgICBpZiAob3V0IGluc3RhbmNlb2YgT2JqZWN0KSB7XHJcbiAgICAgICAgICAgICAgICAvLyBvbmx5IG1lcmdlcyB0cmFpbGluZyBvYmplY3RzIHNpbmNlIHByaW1pdGl2ZXMgd291bGQgd2lwZSBvdXRcclxuICAgICAgICAgICAgICAgIC8vIHByZXZpb3VzIG9iamVjdHMsIGFzIGluIG1lcmdpbmcge2E6J2EnfSwgJ2EnLCBhbmQge2I6J2InfVxyXG4gICAgICAgICAgICAgICAgLy8gd291bGQgcmVzdWx0IGluIHtiOidiJ30gc28gdGhlIGZpcnN0IHR3byBhcmd1bWVudHNcclxuICAgICAgICAgICAgICAgIC8vIGNhbiBiZSBpZ25vcmVkIGNvbXBsZXRlbHkuXHJcbiAgICAgICAgICAgICAgICB2YXIgcmVsZXZhbnRTaGFkb3dzID0gZ2V0U2hhZG93T2JqZWN0cyhzaGFkb3dzKTtcclxuICAgICAgICAgICAgICAgIHJlbGV2YW50U2hhZG93cy5mb3JFYWNoKHNoYWRvd01lcmdlcik7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIG91dDtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIG1haW4oc2hhZG93cyk7XHJcbiAgICB9XHJcbiAgICByZXR1cm4gb2JqZWN0TWVyZ2VSZWN1cnNvcihzaGFkb3dzKTtcclxufVxyXG5tb2R1bGUuZXhwb3J0cyA9IG9iamVjdE1lcmdlOyJdfQ==

@@ -149,2 +149,87 @@ /*

});
it('throws an error on circular references to functions', function () {
var x = {
'a' : function () {return null},
};
x.b = x.a;
function thrower () {
return objectMerge(x);
}
expect(thrower).toThrow();
});
it('throws an error on circular references to arrays', function () {
var x = {
'a' : [],
};
x.b = x.a;
function thrower () {
return objectMerge(x);
}
expect(thrower).toThrow();
});
it('throws an error on circular references to objects', function () {
var x = {
'a' : {}
};
x.b = x.a;
function thrower () {
return objectMerge(x);
}
expect(thrower).toThrow();
});
it('throws an error on circular references to nested objects', function () {
var x = {
'a' : {}
};
x.b = {};
x.b.c = x.a;
function thrower () {
return objectMerge(x);
}
expect(thrower).toThrow();
});
it('throws an error on circular references to string objects', function () {
var x = {
'a' : new String(),
};
x.b = x.a;
function thrower () {
return objectMerge(x);
}
expect(thrower).toThrow();
});
it('throws an error on circular references to number objects', function () {
var x = {
'a' : new Number(),
};
x.b = x.a;
function thrower () {
return objectMerge(x);
}
expect(thrower).toThrow();
});
it('does not throw an error on circular references to scalar string',
function () {
var x = {
'a' : 'x',
};
x.b = x.a;
function thrower () {
return objectMerge(x);
}
expect(thrower).not.toThrow();
}
);
it('does not throw an error on circular references to scalar number',
function () {
var x = {
'a' : 5,
};
x.b = x.a;
function thrower () {
return objectMerge(x);
}
expect(thrower).not.toThrow();
}
);
});
{
"name": "object-merge",
"version": "2.2.3",
"version": "2.3.0",
"description": "Merges JavaScript objects recursively without altering the objects merged.",

@@ -5,0 +5,0 @@ "main": "./src/object-merge.js",

@@ -99,27 +99,48 @@ /*

}
function main(shadows) {
var out = getOutputObject(shadows);
function shadowHandler(val, prop, shadow) {
// this is the queue of visited objects / properties.
var visited = [];
function objectMergeRecursor(shadows) {
// if any of the current objects to process exist in the queue
// then throw an error.
shadows.forEach(function (item) {
if (item instanceof Object && visited.indexOf(item) > -1) {
throw new Error('Circular reference error');
}
});
// if none of the current objects were in the queue then add references
// to the queue.
visited = visited.concat(shadows);
function main(shadows) {
var out = getOutputObject(shadows);
/*jslint unparam:true */
if (out[prop]) {
out[prop] = objectMerge(out[prop], shadow[prop]);
} else {
out[prop] = objectMerge(shadow[prop]);
function shadowHandler(val, prop, shadow) {
if (out[prop]) {
out[prop] = objectMergeRecursor([
out[prop],
shadow[prop]
]);
} else {
out[prop] = objectMergeRecursor([shadow[prop]]);
}
}
/*jslint unparam:false */
function shadowMerger(shadow) {
objectForeach(shadow, shadowHandler);
}
// short circuits case where output would be a primitive value
// anyway.
if (out instanceof Object) {
// only merges trailing objects since primitives would wipe out
// previous objects, as in merging {a:'a'}, 'a', and {b:'b'}
// would result in {b:'b'} so the first two arguments
// can be ignored completely.
var relevantShadows = getShadowObjects(shadows);
relevantShadows.forEach(shadowMerger);
}
return out;
}
function shadowMerger(shadow) {
objectForeach(shadow, shadowHandler);
}
// short circuits case where output would be a primitive value anyway.
if (out instanceof Object) {
// only merges trailing objects since primitives would wipe out previous
// objects, as in merging {a:'a'}, 'a', and {b:'b'} would result in
// {b:'b'} so the first two arguments can be ignored completely.
var relevantShadows = getShadowObjects(shadows);
relevantShadows.forEach(shadowMerger);
}
return out;
return main(shadows);
}
return main(shadows);
return objectMergeRecursor(shadows);
}
module.exports = objectMerge;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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