Comparing version 0.6.1 to 0.6.2
@@ -29,3 +29,3 @@ "use strict"; | ||
if (typeof source1 !== 'object' || source1 === null) | ||
return source2 || source1; | ||
return source2 !== undefined ? source2 : source1; | ||
if (Array.isArray(source1)) { | ||
@@ -32,0 +32,0 @@ return Array.isArray(source2) ? source2 : source1.concat([source2]); |
@@ -14,3 +14,3 @@ export function required(source1, source2, source3) { | ||
if (typeof source1 !== 'object' || source1 === null) | ||
return source2 || source1; | ||
return source2 !== undefined ? source2 : source1; | ||
if (Array.isArray(source1)) { | ||
@@ -17,0 +17,0 @@ return Array.isArray(source2) ? source2 : [...source1, source2]; |
{ | ||
"name": "unpartial", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "Unpartial a partialed object", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/unional/unpartial", |
@@ -140,2 +140,6 @@ import { required, requiredDeep } from './required'; | ||
}) | ||
test('empty string overrides', () => { | ||
expect(requiredDeep({ a: { b: 'b' } }, { a: { b: '' } })).toEqual({ a: { b: '' } }) | ||
}) | ||
}) |
@@ -24,3 +24,3 @@ export function required< | ||
function deepmerge(source1: any, source2: any): any { | ||
if (typeof source1 !== 'object' || source1 === null) return source2 || source1 | ||
if (typeof source1 !== 'object' || source1 === null) return source2 !== undefined ? source2 : source1 | ||
if (Array.isArray(source1)) { | ||
@@ -27,0 +27,0 @@ return Array.isArray(source2) ? source2 : [...source1, source2] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
29880
415