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

    Function isIterable

    • Checks whether a value implements the iterable protocol, preserving the element type when the input is already typed as Iterable<T>.

      • T
      • value: T | Iterable<T, any, any>

        Value or iterable to test.

      Type predicate narrowing value to Iterable<T>.

    • Checks whether a value implements the iterable protocol.

      • value: unknown

        Any value to test for iterable protocol support.

      true when value is a non-null object with a callable Symbol.iterator (e.g. arrays, Map, Set); false for null, primitives, and plain objects.

      isIterable(new Map()); // true
      isIterable(new Set()); // true
      isIterable([]); // true
      isIterable(null); // false
      isIterable({}); // false