@travetto/base
Advanced tools
Comparing version 0.0.57 to 0.0.58
@@ -21,3 +21,3 @@ { | ||
"scripts": {}, | ||
"version": "0.0.57" | ||
"version": "0.0.58" | ||
} |
@@ -18,2 +18,10 @@ export function isPrimitive(el: any): el is (string | boolean | number | RegExp) { | ||
export function isClass(o: any) { | ||
return o && o.prototype && o.prototype.constructor !== Object.getPrototypeOf(Function); | ||
} | ||
export function isSimple(a: any) { | ||
return isPrimitive(a) || isFunction(a) || isClass(a); | ||
} | ||
function _deepMerge(a: any, b: any, level = 0) { | ||
@@ -29,4 +37,4 @@ const isEmptyA = a === undefined || a === null; | ||
if (isPrimitive(b) || isFunction(b)) { | ||
if (isEmptyA || isPrimitive(a) || isFunction(a)) { | ||
if (isSimple(b)) { // Scalars | ||
if (isEmptyA || isSimple(a)) { | ||
a = b; | ||
@@ -36,3 +44,3 @@ } else { | ||
} | ||
} else if (isArrB) { | ||
} else if (isArrB) { // Arrays | ||
const bArr = b; | ||
@@ -50,3 +58,3 @@ if (a === undefined) { | ||
} | ||
} else { | ||
} else { // Object | ||
if (isEmptyA || isArrA || isPrimitive(a)) { | ||
@@ -53,0 +61,0 @@ if (level === 0) { |
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
16632
509