@amphibian/extend
v1.1.16
Published
extends a parent object while letting keys from child overwrite it
Downloads
53
Readme
extend
extends a parent object while letting keys from child overwrite it
npm install @amphibian/extend
var extend = require('@amphibian/extend');
var parent = {
obj: {
foo: 'bar',
bar: 'foo'
},
obj2: {
foo: 'bar',
bar: 'foo'
},
arr: [0, 1, 2, 3]
};
var child = {
obj: {
foo: 'overwrite'
},
obj2: false,
arr: ['hello']
};
// Extend parent object
extend(parent, child); // > {obj: {foo: 'overwrite', bar: 'foo'}, obj2: false, arr: ['hello']}