Skip to content

Function: isArrayLikeObject()

ts
function isArrayLikeObject(value): boolean;

Checks if a value is an array-like object (not string or function). 检查值是否为类数组对象(非字符串或函数)。

Parameters

ParameterTypeDescription
valueunknownThe value to check / 要检查的值

Returns

boolean

True if the value is an array-like object / 如果值是类数组对象则返回true

Example

typescript
isArrayLikeObject([1, 2, 3]) // => true
isArrayLikeObject({ 0: 'a', 1: 'b', length: 2 }) // => true
isArrayLikeObject(new Uint8Array([1, 2, 3])) // => true
isArrayLikeObject('abc') // => false (string, not object)
isArrayLikeObject({}) // => false (no length property)
isArrayLikeObject(null) // => false
isArrayLikeObject(42) // => false

Since

1.0.0

Released under the MIT License.