Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

util-deep-merge

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

util-deep-merge

Deeply merge Javascript objects and arrays

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

A small utility for deeply merging two different Javascript objects.

Installation

yarn add util-deep-merge

Usage

import deepMerge from 'util-deep-merge';

const array1 = [1, 2];
const array2 = [2, 3];
deepMerge(array1, array2);
// => [1, 2, 3]

const obj1 = { id: 1 };
const obj2 = { name: 'Mark' };
deepMerge(obj1, obj2);
// => { id: 1, name: 'Mark' }

const obj1 = { ids: [1, 2, 3] };
const obj2 = { ids: [2, 3, 4, 5] };
deepMerge(obj1, obj2);
// => { ids: [1, 2, 3, 4, 5] };

deepMerge('a', 'b');
// => 'b'

deepMerge(1, 2);
// => 2

Keywords

FAQs

Package last updated on 13 Feb 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc