Add is.arrayLike() (#26)
This commit is contained in:
parent
0bafa04e77
commit
83adc096ef
3 changed files with 29 additions and 0 deletions
3
index.js
3
index.js
|
|
@ -155,6 +155,9 @@ const typedArrayTypes = new Set([
|
|||
]);
|
||||
is.typedArray = x => typedArrayTypes.has(getObjectType(x));
|
||||
|
||||
const isValidLength = x => is.safeInteger(x) && x > -1;
|
||||
is.arrayLike = x => !is.nullOrUndefined(x) && !is.function(x) && isValidLength(x.length);
|
||||
|
||||
is.inRange = (x, range) => {
|
||||
if (is.number(range)) {
|
||||
return x >= Math.min(0, range) && x <= Math.max(range, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue