@travetto/base
Advanced tools
Comparing version 0.0.54 to 0.0.55
@@ -21,3 +21,3 @@ { | ||
"scripts": {}, | ||
"version": "0.0.54" | ||
"version": "0.0.55" | ||
} |
@@ -1,2 +0,2 @@ | ||
export function isPrimitive(el: any) { | ||
export function isPrimitive(el: any): el is (string | boolean | number | RegExp) { | ||
const type = typeof el; | ||
@@ -6,3 +6,3 @@ return (type === 'string' || type === 'boolean' || type === 'number' || el instanceof RegExp); | ||
export function isPlainObject(obj: any) { | ||
export function isPlainObject(obj: any): obj is object { | ||
return typeof obj === 'object' // separate from primitives | ||
@@ -14,2 +14,6 @@ && obj !== null // is obvious | ||
export function isFunction(o: any): o is Function { | ||
return Object.getPrototypeOf(o) === Function.prototype; | ||
} | ||
export function deepMerge<T extends any, U extends any>(a: T, b: U): T & U { | ||
@@ -24,3 +28,3 @@ const isEmptyA = a === undefined || a === null; | ||
if (isEmptyA || isPrimitive(a)) { | ||
return b as (T & U); | ||
return b as any as (T & U); | ||
} else { | ||
@@ -27,0 +31,0 @@ throw new Error(`Cannot merge primitive ${b} with ${a}`); |
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
15666
479