flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
31
VISUALIZACION/node_modules/ngraph.merge/index.js
generated
vendored
Executable file
31
VISUALIZACION/node_modules/ngraph.merge/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
module.exports = merge;
|
||||
|
||||
/**
|
||||
* Augments `target` with properties in `options`. Does not override
|
||||
* target's properties if they are defined and matches expected type in
|
||||
* options
|
||||
*
|
||||
* @returns {Object} merged object
|
||||
*/
|
||||
function merge(target, options) {
|
||||
var key;
|
||||
if (!target) { target = {}; }
|
||||
if (options) {
|
||||
for (key in options) {
|
||||
if (options.hasOwnProperty(key)) {
|
||||
var targetHasIt = target.hasOwnProperty(key),
|
||||
optionsValueType = typeof options[key],
|
||||
shouldReplace = !targetHasIt || (typeof target[key] !== optionsValueType);
|
||||
|
||||
if (shouldReplace) {
|
||||
target[key] = options[key];
|
||||
} else if (optionsValueType === 'object') {
|
||||
// go deep, don't care about loops here, we are simple API!:
|
||||
target[key] = merge(target[key], options[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue