@jossmac/lil-libs
    Preparing search index...

    Function isLength

    • Checks whether an array has an exact length, narrowing the type to a fixed-length tuple.

      • T
      • N extends number
      • arr: readonly T[]

        Array whose length is compared.

      • length: N

        Exact length to match; when equal, narrows arr to a fixed-length tuple type.

      true when arr.length equals length exactly.

      const values: number[] = [1, 2, 3];
      if (isLength(values, 3)) {
      // values: [number, number, number]
      }
      isLength(values, 2); // false