object-merge
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -74,5 +74,31 @@ (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){ | ||
* Creates a new options object suitable for use with objectMerge. | ||
* @memberOf objectMerge | ||
* @param {Object} [opts] An object specifying the options. | ||
* @param {Object} [opts.depth = false] Specifies the depth to traverse objects | ||
* during merging. If this is set to false then there will be no depth limit. | ||
* @param {Object} [opts.throwOnCircularRef = true] Set to false to suppress | ||
* errors on circular references. | ||
* @returns {ObjectMergeOptions} Returns an instance of ObjectMergeOptions | ||
* to be used with objectMerge. | ||
* @example | ||
* var opts = objectMerge.createOptions({ | ||
* depth : 2, | ||
* throwOnCircularRef : false | ||
* }); | ||
* var obj1 = { | ||
* a1 : { | ||
* a2 : { | ||
* a3 : {} | ||
* } | ||
* } | ||
* }; | ||
* var obj2 = { | ||
* a1 : { | ||
* a2 : { | ||
* a3 : 'will not be in output' | ||
* }, | ||
* a22 : {} | ||
* } | ||
* }; | ||
* objectMerge(opts, obj1, obj2); | ||
*/ | ||
@@ -89,2 +115,3 @@ function createOptions(opts) { | ||
* Merges JavaScript objects recursively without altering the objects merged. | ||
* @namespace | ||
* @author <a href="mailto:matthewkastor@gmail.com">Matthew Kastor</a> | ||
@@ -199,9 +226,13 @@ * @param {ObjectMergeOptions} [opts] An options object created by | ||
} | ||
function main(shadows) { | ||
function objectMergeRecursor(shadows, currentDepth) { | ||
if (options.depth !== false) { | ||
currentDepth = currentDepth ? currentDepth + 1 : 1; | ||
} else { | ||
currentDepth = 0; | ||
} | ||
if (options.throwOnCircularRef === true) { | ||
circularReferenceCheck(shadows); | ||
} | ||
var out = getOutputObject(shadows); | ||
/*jslint unparam: true */ | ||
// recursor defined below. Dougie removed the intelligent suppression of | ||
// this warning, probably because of functions that reference each other. | ||
// So, you're stuck with making sure this isn't a mistake every time you | ||
// use his linter. | ||
function shadowHandler(val, prop, shadow) { | ||
@@ -212,5 +243,5 @@ if (out[prop]) { | ||
shadow[prop] | ||
]); | ||
], currentDepth); | ||
} else { | ||
out[prop] = objectMergeRecursor([shadow[prop]]); | ||
out[prop] = objectMergeRecursor([shadow[prop]], currentDepth); | ||
} | ||
@@ -224,3 +255,3 @@ } | ||
// anyway. | ||
if (out instanceof Object) { | ||
if (out instanceof Object && currentDepth <= options.depth) { | ||
// only merges trailing objects since primitives would wipe out | ||
@@ -235,8 +266,2 @@ // previous objects, as in merging {a:'a'}, 'a', and {b:'b'} | ||
} | ||
function objectMergeRecursor(shadows) { | ||
if (options.throwOnCircularRef === true) { | ||
circularReferenceCheck(shadows); | ||
} | ||
return main(shadows); | ||
} | ||
// determines whether an options object was passed in and | ||
@@ -257,2 +282,2 @@ // uses it if present | ||
},{"clone-function":2,"object-foreach":3}]},{},[1]) | ||
//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlcyI6WyJDOi9Vc2Vycy9rYXN0b3IvRG9jdW1lbnRzL0dpdEh1Yi9vYmplY3QtbWVyZ2UvZGV2L2Jyb3dzZXJNYWluLmpzIiwiQzovVXNlcnMva2FzdG9yL0RvY3VtZW50cy9HaXRIdWIvb2JqZWN0LW1lcmdlL25vZGVfbW9kdWxlcy9jbG9uZS1mdW5jdGlvbi9zcmMvY2xvbmUtZnVuY3Rpb24uanMiLCJDOi9Vc2Vycy9rYXN0b3IvRG9jdW1lbnRzL0dpdEh1Yi9vYmplY3QtbWVyZ2Uvbm9kZV9tb2R1bGVzL29iamVjdC1mb3JlYWNoL3NyYy9vYmplY3QtZm9yZWFjaC5qcyIsIkM6L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iamVjdCB0byBtZXJnZS4gRWFjaCBvYmplY3RcclxuICogIG92ZXJ3cml0ZXMgdGhlIHByZXZpb3VzIG9iamVjdHMgZGVzY2VuZGFudCBwcm9wZXJ0aWVzIGlmIHRoZSBwcm9wZXJ0eSBuYW1lXHJcbiAqICBtYXRjaGVzLiBJZiBvYmplY3RzIHByb3BlcnRpZXMgYXJlIG9iamVjdHMgdGhleSB3aWxsIGJlIG1lcmdlZCByZWN1cnNpdmVseVxyXG4gKiAgYXMgd2VsbC5cclxuICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyBhIHNpbmdsZSBtZXJnZWQgb2JqZWN0IGNvbXBvc2VkIGZyb20gY2xvbmVzIG9mIHRoZVxyXG4gKiAgaW5wdXQgb2JqZWN0cy5cclxuICogQGV4YW1wbGVcclxuICogIHZhciBvYmplY3RNZXJnZSA9IHJlcXVpcmUoJ29iamVjdC1tZXJnZScpO1xyXG4gKiAgdmFyIHggPSB7XHJcbiAqICAgICAgYSA6ICdhJyxcclxuICogICAgICBiIDogJ2InLFxyXG4gKiAgICAgIGMgOiB7XHJcbiAqICAgICAgICAgIGQgOiAnZCcsXHJcbiAqICAgICAgICAgIGUgOiAnZScsXHJcbiAqICAgICAgICAgIGYgOiB7XHJcbiAqICAgICAgICAgICAgICBnIDogJ2cnXHJcbiAqICAgICAgICAgIH1cclxuICogICAgICB9XHJcbiAqICB9O1xyXG4gKiAgdmFyIHkgPSB7XHJcbiAqICAgICAgYSA6ICdgYScsXHJcbiAqICAgICAgYiA6ICdgYicsXHJcbiAqICAgICAgYyA6IHtcclxuICogICAgICAgICAgZCA6ICdgZCdcclxuICogICAgICB9XHJcbiAqICB9O1xyXG4gKiAgdmFyIHogPSB7XHJcbiAqICAgICAgYSA6IHtcclxuICogICAgICAgICAgYiA6ICdgYGInXHJcbiAqICAgICAgfSxcclxuICogICAgICBmdW4gOiBmdW5jdGlvbiBmb28gKCkge1xyXG4gKiAgICAgICAgICByZXR1cm4gJ2Zvbyc7XHJ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uICogICAgICBiIDogJ2BiJyxcclxuICogICAgICBjIDoge1xyXG4gKiAgICAgICAgICBkIDogJ2BkJ1xyXG4gKiAgICAgIH1cclxuICogIH07XHJcbiAqICB2YXIgeiA9IHtcclxuICogICAgICBhIDoge1xyXG4gKiAgICAgICAgICBiIDogJ2BgYidcclxuICogICAgICB9LFxyXG4gKiAgICAgIGZ1biA6IGZ1bmN0aW9uIGZvbyAoKSB7XHJcbiAqICAgICAgICAgIHJldHVybiAnZm9vJztcclxuICogICAgICB9LFxyXG4gKiAgICAgIGFwcyA6IEFycmF5LnByb3RvdHlwZS5zbGljZVxyXG4gKiAgfTtcclxuICogIHZhciBvdXQgPSBvYmplY3RNZXJnZSh4LCB5LCB6KTtcclxuICogIC8vIG91dC5hIHdpbGwgYmUge1xyXG4gKiAgLy8gICAgICAgICBiIDogJ2BgYidcclxuICogIC8vICAgICB9XHJcbiAqICAvLyBvdXQuYiB3aWxsIGJlICdgYidcclxuICogIC8vIG91dC5jIHdpbGwgYmUge1xyXG4gKiAgLy8gICAgICAgICBkIDogJ2BkJyxcclxuICogIC8vICAgICAgICAgZSA6ICdlJyxcclxuICogIC8vICAgICAgICAgZiA6IHtcclxuICogIC8vICAgICAgICAgICAgIGcgOiAnZydcclxuICogIC8vICAgICAgICAgfVxyXG4gKiAgLy8gICAgIH1cclxuICogIC8vIG91dC5mdW4gd2lsbCBiZSBhIGNsb25lIG9mIHouZnVuXHJcbiAqICAvLyBvdXQuYXBzIHdpbGwgYmUgZXF1YWwgdG8gei5hcHNcclxuICovXHJcbmZ1bmN0aW9uIG9iamVjdE1lcmdlKHNoYWRvd3MpIHtcclxuICAgICd1c2Ugc3RyaWN0JztcclxuICAgIHZhciBvYmplY3RGb3JlYWNoID0gcmVxdWlyZSgnb2JqZWN0LWZvcmVhY2gnKTtcclxuICAgIHZhciBjbG9uZUZ1bmN0aW9uID0gcmVxdWlyZSgnY2xvbmUtZnVuY3Rpb24nKTtcclxuICAgIC8vIHRoaXMgaXMg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ICBvdXQgPSBbXTtcclxuICAgICAgICB9IGVsc2UgaWYgKGxhc3RTaGFkb3cgaW5zdGFuY2VvZiBGdW5jdGlvbikge1xyXG4gICAgICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICAgICAgb3V0ID0gY2xvbmVGdW5jdGlvbihsYXN0U2hhZG93KTtcclxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xyXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGUubWVzc2FnZSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9IGVsc2UgaWYgKGxhc3RTaGFkb3cgaW5zdGFuY2VvZiBPYmplY3QpIHtcclxuICAgICAgICAgICAgb3V0ID0ge307XHJcbiAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgLy8gbGFzdFNoYWRvdyBpcyBhIHByaW1pdGl2ZSB2YWx1ZTtcclxuICAgICAgICAgICAgb3V0ID0gbGFzdFNoYWRvdztcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIG91dDtcclxuICAgIH1cclxuICAgIC8vIGNoZWNrcyBmb3IgY2lyY3VsYXIgcmVmZXJlbmNlc1xyXG4gICAgZnVuY3Rpb24gY2lyY3VsYXJSZWZlcmVuY2VDaGVjayhzaGFkb3dzKSB7XHJcbiAgICAgICAgLy8gaWYgYW55IG9mIHRoZSBjdXJyZW50IG9iamVjdHMgdG8gcHJvY2VzcyBleGlzdCBpbiB0aGUgcXVldWVcclxuICAgICAgICAvLyB0aGVuIHRocm93IGFuIGVycm9yLlxyXG4gICAgICAgIHNoYWRvd3MuZm9yRWFjaChmdW5jdGlvbiAoaXRlbSkge1xyXG4gICAgICAgICAgICBpZiAoaXRlbSBpbnN0YW5jZW9mIE9iamVjdCAmJiB2aXNpdGVkLmluZGV4T2YoaXRlbSkgPiAtMSkge1xyXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDaXJjdWxhciByZWZlcmVuY2UgZXJyb3InKTtcclx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FudFNoYWRvd3MuZm9yRWFjaChzaGFkb3dNZXJnZXIpO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gb3V0O1xyXG4gICAgfVxyXG4gICAgLy8gZGV0ZXJtaW5lcyB3aGV0aGVyIGFuIG9wdGlvbnMgb2JqZWN0IHdhcyBwYXNzZWQgaW4gYW5kXHJcbiAgICAvLyB1c2VzIGl0IGlmIHByZXNlbnRcclxuICAgIC8vIGlnbm9yZSB0aGUganNsaW50IHdhcm5pbmcgaGVyZSB0b28uXHJcbiAgICBpZiAoYXJndW1lbnRzWzBdIGluc3RhbmNlb2YgT2JqZWN0TWVyZ2VPcHRpb25zKSB7XHJcbiAgICAgICAgb3B0aW9ucyA9IGFyZ3VtZW50c1swXTtcclxuICAgICAgICBzaGFkb3dzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTtcclxuICAgIH0gZWxzZSB7XHJcbiAgICAgICAgb3B0aW9ucyA9IGNyZWF0ZU9wdGlvbnMoKTtcclxuICAgICAgICBzaGFkb3dzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAwKTtcclxuICAgIH1cclxuICAgIHJldHVybiBvYmplY3RNZXJnZVJlY3Vyc29yKHNoYWRvd3MpO1xyXG59XHJcbm9iamVjdE1lcmdlLmNyZWF0ZU9wdGlvbnMgPSBjcmVhdGVPcHRpb25zO1xyXG5tb2R1bGUuZXhwb3J0cyA9IG9iamVjdE1lcmdlOyJdfQ== |
@@ -305,7 +305,17 @@ /* | ||
}; | ||
var b = { | ||
'b1' : { | ||
'b2' : { | ||
'b3' : {} | ||
} | ||
} | ||
}; | ||
var opts = objectMerge.createOptions({depth : 2}); | ||
var res = objectMerge(opts, a); | ||
var res = objectMerge(opts, a, b); | ||
expect(res).toEqual({ | ||
'a1' : { | ||
'a2' : {} | ||
}, | ||
'b1' : { | ||
'b2' : {} | ||
} | ||
@@ -312,0 +322,0 @@ }); |
{ | ||
"name": "object-merge", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Merges JavaScript objects recursively without altering the objects merged.", | ||
@@ -5,0 +5,0 @@ "main": "./src/object-merge.js", |
@@ -20,5 +20,31 @@ /* | ||
* Creates a new options object suitable for use with objectMerge. | ||
* @memberOf objectMerge | ||
* @param {Object} [opts] An object specifying the options. | ||
* @param {Object} [opts.depth = false] Specifies the depth to traverse objects | ||
* during merging. If this is set to false then there will be no depth limit. | ||
* @param {Object} [opts.throwOnCircularRef = true] Set to false to suppress | ||
* errors on circular references. | ||
* @returns {ObjectMergeOptions} Returns an instance of ObjectMergeOptions | ||
* to be used with objectMerge. | ||
* @example | ||
* var opts = objectMerge.createOptions({ | ||
* depth : 2, | ||
* throwOnCircularRef : false | ||
* }); | ||
* var obj1 = { | ||
* a1 : { | ||
* a2 : { | ||
* a3 : {} | ||
* } | ||
* } | ||
* }; | ||
* var obj2 = { | ||
* a1 : { | ||
* a2 : { | ||
* a3 : 'will not be in output' | ||
* }, | ||
* a22 : {} | ||
* } | ||
* }; | ||
* objectMerge(opts, obj1, obj2); | ||
*/ | ||
@@ -35,2 +61,3 @@ function createOptions(opts) { | ||
* Merges JavaScript objects recursively without altering the objects merged. | ||
* @namespace Merges JavaScript objects recursively without altering the objects merged. | ||
* @author <a href="mailto:matthewkastor@gmail.com">Matthew Kastor</a> | ||
@@ -145,9 +172,13 @@ * @param {ObjectMergeOptions} [opts] An options object created by | ||
} | ||
function main(shadows) { | ||
function objectMergeRecursor(shadows, currentDepth) { | ||
if (options.depth !== false) { | ||
currentDepth = currentDepth ? currentDepth + 1 : 1; | ||
} else { | ||
currentDepth = 0; | ||
} | ||
if (options.throwOnCircularRef === true) { | ||
circularReferenceCheck(shadows); | ||
} | ||
var out = getOutputObject(shadows); | ||
/*jslint unparam: true */ | ||
// recursor defined below. Dougie removed the intelligent suppression of | ||
// this warning, probably because of functions that reference each other. | ||
// So, you're stuck with making sure this isn't a mistake every time you | ||
// use his linter. | ||
function shadowHandler(val, prop, shadow) { | ||
@@ -158,5 +189,5 @@ if (out[prop]) { | ||
shadow[prop] | ||
]); | ||
], currentDepth); | ||
} else { | ||
out[prop] = objectMergeRecursor([shadow[prop]]); | ||
out[prop] = objectMergeRecursor([shadow[prop]], currentDepth); | ||
} | ||
@@ -170,3 +201,3 @@ } | ||
// anyway. | ||
if (out instanceof Object) { | ||
if (out instanceof Object && currentDepth <= options.depth) { | ||
// only merges trailing objects since primitives would wipe out | ||
@@ -181,8 +212,2 @@ // previous objects, as in merging {a:'a'}, 'a', and {b:'b'} | ||
} | ||
function objectMergeRecursor(shadows) { | ||
if (options.throwOnCircularRef === true) { | ||
circularReferenceCheck(shadows); | ||
} | ||
return main(shadows); | ||
} | ||
// determines whether an options object was passed in and | ||
@@ -189,0 +214,0 @@ // uses it if present |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
245950
22
3813