ts-iterable-functions
    Preparing search index...

    Function distinctConst

    • Yields only the first occurrence of each value from the source iterable.

      Curried version of _distinct.

      Type Parameters

      • T

        Element type produced by the source iterable.

      Parameters

      • OptionalsetFactory: SetFactory<T>

        Optional factory supplying the set used to track seen values.

      Returns (src: Iterable) => Iterable

      A deferred iterable yielding each distinct value while preserving order.

      Error Rethrows any error thrown by setFactory.

      const unique = [..._distinct([1, 1, 2, 3])];
      console.log(unique); // [1, 2, 3]

      or using the curried version:

      const unique = [...pipeInto([1, 1, 2, 3], distinct())];
      console.log(unique); // [1, 2, 3]