merge-both
v1.0.1
Published
Merge with support for objects and arrays.
Downloads
5
Readme
Merge both
Merge with support for objects and arrays.
Install
npm install merge-both
Usage
const mergeBoth = require("merge-both");
mergeBoth(
{
a: ["a", "b"],
b: { b: "c" },
c: "e"
},
{
a: ["c", "d"],
b: { b: "f", c: "d" }
}
);
// Returned object
{
a: ["a", "b", "c", "d"],
b: { b: "f", c: "d" },
c: "e",
}
API
mergeBoth(obj, ...source)
obj
Type: object
The main object to merge.
source
Type: object
The other objects to merge.