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

deepmerge

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deepmerge - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

4

index.js

@@ -9,3 +9,5 @@ module.exports = function merge (target, src) {

src.forEach(function(e, i) {
if (typeof e === 'object') {
if (typeof target[i] === 'undefined') {
dst[i] = e
} else if (typeof e === 'object') {
dst[i] = merge(target[i], e)

@@ -12,0 +14,0 @@ } else {

@@ -5,3 +5,3 @@ {

"description": "A library for deep (recursive) merging of Javascript objects",
"version": "0.2.5",
"version": "0.2.6",
"homepage": "https://github.com/nrf110/deepmerge",

@@ -8,0 +8,0 @@ "repository": {

@@ -194,3 +194,19 @@ var merge = require('../')

test('should work on arrays of nested objects', function(t) {
var target = [
{ key1: { subkey: 'one' }}
]
var src = [
{ key1: { subkey: 'two' }},
{ key2: { subkey: 'three' }}
]
var expected = [
{ key1: { subkey: 'two' }},
{ key2: { subkey: 'three' }}
]
t.deepEqual(merge(target, src), expected)
t.end()
})
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