1.0.4 • Published 7 years ago

object-fill v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

object-fill

Fills an existing object with new properties, but only for the keys that already exist.

This also works recursive.


Install

NPM npm install --save object-fill

Yarn yarn add object-fill

Documentation

const newDestination = objectFill(destination, source)

destination: the existing object source: the data that is inserted into the destination

returns: the new object

Example

const objectFill = require('object-fill');

const destination = {
    foo: 'something',
    bar: 'another thing',
};

const source = {
    bar: 'a new string',
    baz: 'an irrelevant string',
}

const newDestination = objectFill(destination, source);

/* newDestination:
 * {
 *     foo: 'something',
 *     bar: 'a new string'
 * }
 */

License: MIT