@nevware21/ts-utils
    Preparing search index...

    Function isArrayLike

    • Function

      Checks if the type of value is array-like (has a numeric length property and numeric indices).

      Parameters

      • arg: any

        Value to be checked.

      Returns arg is ArrayLike<any>

      True if the value is array-like, false otherwise.

      0.14.0

      import { isArrayLike } from "@nevware21/ts-utils";

      isArrayLike([1, 2, 3]); // true
      isArrayLike("hello"); // true
      isArrayLike({ length: 3, 0: "a", 1: "b", 2: "c" }); // true
      isArrayLike({ length: "3" }); // false (length is not a number)
      isArrayLike({ 0: "a", 1: "b" }); // false (no length property)
      isArrayLike(null); // false
      isArrayLike(undefined); // false