@amphibian/extend

extends a parent object while letting keys from child overwrite it

Stats

StarsIssuesVersionUpdatedCreatedSize
@amphibian/extend
1.1.165 years ago6 years agoMinified + gzip package size for @amphibian/extend in KB

Readme

extend

build status

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']}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.