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

recursive-merge

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recursive-merge

Recursive merge tool for arrays and objects

  • 1.2.0
  • npm
  • Socket score

Version published
Weekly downloads
210
decreased by-12.86%
Maintainers
1
Weekly downloads
 
Created
Source

Recursive merge

Recursive merge tool for arrays and objects.

Installation

$ npm install recursive-merge

Usage

With this tool, you can recursively merge arrays or objects.

var merge = require('merge');

var result = merge(
	[1, 1, 2, 3],
	[3, 4, 4, 5],
	[10, 9, 8, 1]
);				// result: [1, 1, 2, 3, 3, 4, 4, 5, 10, 9, 8, 1]

As you can see, this library just merging objects and not removing duplicates.

You should also know, that this affects first object passed to merge function. Every other objects (arrays, objects) are added to the first one. There is not any fast simple and universal solution for cloning objects (arrays yes).

In the same way, you can merge also objects.

If you will try to merge two different types of objects, exception will be thrown. Also if you will try to merge other objects than arrays or objects, exception will be also thrown.

Tests

$ npm test

Changelog

  • 1.2.0

    • Rewritten
  • 1.1.2 - 1.1.3

    • Bugs in IE8
  • 1.1.0 - 1.1.1

    • Rewritten tests
    • Using chai for assertion (not should)
    • Added some tests
    • Added tests for browser
  • 1.0.0

    • Initial first version

Keywords

FAQs

Package last updated on 25 Nov 2013

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