npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

object-merger

1.0.3 • Public • Published

Object Merger

Merge Javascript Objects properly instead of overwriting them. Essentially a deep Object.assign. It's very simple, written in ES6+ and handles a basic deep copy of objects.

This was written due to lack of power with Object.assign and the heavier weight of some alternative packages trying to support everything.

Usage

const merge = require('object-merger');
const obj4 = merge(obj1, obj2, obj3); // returns a new object, doesn't modify existing.

Optionally you could add a static to the Object

Object.merge = require('object-merger');
const obj4 = Object.merge(obj1, obj2, obj3); // returns a new object, doesn't modify existing.

Check out the test folder for more!

Installation

$ npm install object-merger

Features

  • Merge multiple objects instead of overwrite them.
  • Simple, fast, light-weight with no external dependencies
  • Written in ES6+ for node.js 6+
  • Test driven

Options

As many objects as you'd like to merge from left to right.

Tests

From the package

$ npm test

License

MIT

install

npm i object-merger

Downloadsweekly downloads

2

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability