Skip to content

Repository files navigation

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

About

TS lib to deep merge objects.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages