Socket
Book a DemoInstallSign in
Socket

@fingerartur/ts-merge-objects

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fingerartur/ts-merge-objects

Lib to deep merge two objects

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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

Keywords

deep

FAQs

Package last updated on 05 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts