plain-object-merge
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -17,3 +17,5 @@ "use strict"; | ||
if (isPrimitive(value)) { | ||
target[key] = value; | ||
if (value !== undefined || !(key in target)) { | ||
target[key] = value; | ||
} | ||
} | ||
@@ -20,0 +22,0 @@ else if (!target[key] || Array.isArray(value)) { |
{ | ||
"name": "plain-object-merge", | ||
"description": "Extremely fast function optimized for deep merging json-serializable plain objects.", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "dist/index.d.ts", |
@@ -31,4 +31,8 @@ | ||
target[key] = value; | ||
if ( value !== undefined || !(key in target) ) { | ||
target[key] = value; | ||
} | ||
} else if ( !target[key] || Array.isArray ( value ) ) { | ||
@@ -35,0 +39,0 @@ |
@@ -21,3 +21,3 @@ | ||
null: null, | ||
undefined: undefined, | ||
undefined: 123, | ||
arr: ['1', '2', '3'], | ||
@@ -24,0 +24,0 @@ deep: { |
@@ -12,3 +12,3 @@ | ||
it ( 'works', t => { | ||
it ( 'can merge complext objects', t => { | ||
@@ -19,2 +19,12 @@ t.deepEqual ( merge ( Fixtures.parts ), Fixtures.result ); | ||
it ( 'supports undefined', t => { | ||
t.deepEqual ( merge ([ {}, { foo: undefined } ]), { foo: undefined } ); | ||
t.deepEqual ( merge ([ { foo: 0 }, { foo: undefined } ]), { foo: 0 } ); | ||
t.deepEqual ( merge ([ { foo: {} }, { foo: undefined } ]), { foo: {} } ); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8174
12
202