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.4 to 0.2.5

7

index.js

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

}
Object.keys(src).forEach(function (key) {

@@ -30,3 +29,7 @@ if (typeof src[key] !== 'object' || !src[key]) {

else {
dst[key] = merge(target[key], src[key])
if (!target[key]) {
dst[key] = src[key]
} else {
dst[key] = merge(target[key], src[key])
}
}

@@ -33,0 +36,0 @@ })

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

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

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

@@ -87,2 +87,24 @@ var merge = require('../')

test('should add nested object in target', function(t) {
var src = {
"b": {
"c": {}
}
}
var target = {
"a": {}
}
var expected = {
"a": {},
"b": {
"c": {}
}
}
t.deepEqual(merge(target, src), expected)
t.end()
})
test('should replace object with simple key in target', function (t) {

@@ -89,0 +111,0 @@ var src = { key1: 'value1' }

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