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

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i object-merger

    Weekly Downloads

    10

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • jarradseers