UNPKG

is-array-like-x

Version:
17 lines (14 loc) 556 B
import isNil from 'is-nil-x'; import isFunction from 'is-function-x'; import isLength from 'is-length-x'; /** * Checks if value is array-like. A value is considered array-like if it's * not a function and has a `length` that's an integer greater than or * equal to 0 and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @param {*} value - The object to be tested. */ const isArrayLike = function isArrayLike(value) { return isNil(value) === false && isFunction(value, true) === false && isLength(value.length); }; export default isArrayLike;