Prelude API
    Preparing search index...

    Function length

    • Returns the length of an iterable. If the iterable has a length property (like arrays), uses that property. Otherwise, counts all elements in the iterable.

      Parameters

      • values: Iterable<unknown, any, any> & { length?: number }

        The iterable to get the length of

      Returns number

      The number of elements in the iterable

      G.length([1, 2, 3]); // 3 (uses array.length)
      G.length(new Set([1, 2, 3])); // 3 (uses Set.size)
      G.length(G.range(1, 5)); // 4 (counts generator elements)

      count - For counting elements without checking for length property