@corefunc/corefunc
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -5,4 +5,4 @@ /** | ||
*/ | ||
export default function checkIsKeyed(value) { | ||
export default function checkIsKeyed(value: any): boolean { | ||
return value instanceof Set || value instanceof Map; | ||
} |
/** | ||
* @name isPrimitive | ||
* @name checkIsPrimitive | ||
* @description Return true on boolean, string, number, BigInt, null, Symbol and undefined | ||
@@ -7,4 +7,4 @@ * @param {*} value | ||
*/ | ||
export default function isPrimitive(value: any): boolean { | ||
export default function checkIsPrimitive(value: any): boolean { | ||
return Object(value) !== value; | ||
} |
@@ -1,6 +0,4 @@ | ||
import fnIsObjectLike from "lodash-es/isObjectLike"; | ||
import fnKeys from "lodash-es/keys"; | ||
import checkIsKeyed from "../check/isKeyed"; | ||
import checkIsObjectLike from "../check/isObjectLike"; | ||
import fnIsKeyed from "../is/isKeyed"; | ||
/** | ||
@@ -11,15 +9,13 @@ * Pick object property from list of names | ||
*/ | ||
function keys(iterable) { | ||
export default function collectionKeys(iterable: any): any[] { | ||
if (!iterable) { | ||
return []; | ||
} | ||
if (fnIsObjectLike(iterable) === false) { | ||
if (Array.isArray(iterable) || checkIsKeyed(iterable)) { | ||
return Array.from(iterable.keys()); | ||
} | ||
if (checkIsObjectLike(iterable) === false) { | ||
return []; | ||
} | ||
if (Array.isArray(iterable) || fnIsKeyed(iterable)) { | ||
return Array.from(iterable.keys()); | ||
} | ||
return fnKeys(iterable); | ||
return Object.keys(iterable); | ||
} | ||
export default keys; |
@@ -61,3 +61,3 @@ { | ||
}, | ||
"version": "0.0.32" | ||
"version": "0.0.33" | ||
} |
@@ -0,1 +1,3 @@ | ||
![CoreFunc](docs/img/logo_200.png?raw=true "CoreFunc") | ||
# CoreFunc | ||
@@ -2,0 +4,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
137633
349
4607
69