@trojs/deep-merge
v0.4.7
Published
Object deep merge
Downloads
2,169
Readme
Object deep merge
Deep merge objects.
Zero dependencies.
Installation
npm install @trojs/deep-merge
or
yarn add @trojs/deep-merge
Test the package
npm run test
or
yarn test
How to use
npm i @trojs/deep-merge
import { deepMerge } from '@hcklrnews/deep-merge';
const obj1 = {
a: 1,
b: 1,
c: { x: 1, y: 1 },
d: [1, 1]
}
const obj2 = {
b: 2,
c: { y: 2, z: 2 },
d: [2, 2],
e: 2
}
const result = deepMerge(obj1, obj2)
const expectedResult = {
a: 1,
b: 2,
c: { x: 1, y: 2, z: 2 },
d: [1, 1, 2, 2],
e: 2
}