Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 2.35 KB

README.md

File metadata and controls

59 lines (43 loc) · 2.35 KB

Object deep merge

NPM version Coverage Quality Gate Status Bugs Code Smells Technical Debt Vulnerabilities Maintainability Rating Reliability Rating Security Rating

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
}