Function isArrayLike

  • Checks if value is array-like. A value is considered array-like if it's not a function and has a value.length that's an integer greater than or equal to 0 and less than or equal to Number.MAX_SAFE_INTEGER.

    Type Parameters

    • Value

    Parameters

    Returns Value extends FunctionT
        ? false
        : Value extends {
                length: number;
            }
            ? true
            : unknown extends Value
                ? boolean
                : false

    Since

    1.0.0

    Example

    isArrayLike([1, 2, 3]);
    // => true

    Example

    isArrayLike(document.body.children);
    // => true

    Example

    isArrayLike("abc");
    // => true

    Example

    isArrayLike(() => 0);
    // => false