@fingerartur/ts-merge-objects
v1.1.0
Published
Lib to deep merge two objects
Downloads
150
Readme
Merge objects
Deep merge two objects
import { merge } from '@fingerartur/ts-merge-objects'
const obj1 = { a: 1, b: { name: 'Tom' }}
const obj2 = { b: { name: 'Jerry' }, c: 4 }
const result = merge(obj1, obj2)
// result:
// { a: 1, b: { name: 'Jerry' }, c: 4 }
Notes:
- arrays get overwritten just like any other attribute
Changelog
- v1.1.0
merge
accepts any number of objects now
- v1.0.1
merge
function