Comparing version 0.6.2 to 0.6.3
@@ -31,3 +31,7 @@ "use strict"; | ||
if (Array.isArray(source1)) { | ||
return Array.isArray(source2) ? source2 : source1.concat([source2]); | ||
if (Array.isArray(source2)) | ||
return source2; | ||
if (source2 === undefined) | ||
return source1.slice(); | ||
return source1.concat([source2]); | ||
} | ||
@@ -34,0 +38,0 @@ return getAllKeys(source1).concat(getAllKeys(source2)).reduce(function (p, k) { |
@@ -16,3 +16,7 @@ export function required(source1, source2, source3) { | ||
if (Array.isArray(source1)) { | ||
return Array.isArray(source2) ? source2 : [...source1, source2]; | ||
if (Array.isArray(source2)) | ||
return source2; | ||
if (source2 === undefined) | ||
return [...source1]; | ||
return [...source1, source2]; | ||
} | ||
@@ -19,0 +23,0 @@ return getAllKeys(source1).concat(getAllKeys(source2)).reduce((p, k) => { |
{ | ||
"name": "unpartial", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "Unpartial a partialed object", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/unional/unpartial", |
@@ -144,2 +144,6 @@ import { required, requiredDeep } from './required'; | ||
}) | ||
test('undefined property not added to array', () => { | ||
expect(requiredDeep({ a: [1] }, {})).toEqual({ a: [1] }) | ||
}) | ||
}) |
@@ -26,3 +26,5 @@ export function required< | ||
if (Array.isArray(source1)) { | ||
return Array.isArray(source2) ? source2 : [...source1, source2] | ||
if (Array.isArray(source2)) return source2 | ||
if (source2 === undefined) return [...source1] | ||
return [...source1, source2] | ||
} | ||
@@ -29,0 +31,0 @@ |
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
30357
428