ts-iterable-functions
    Preparing search index...

    Function _distinct

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

      Type Parameters

      • T

        Element type produced by the source iterable.

      Parameters

      • src: Iterable<T>

        Source iterable enumerated for unique values.

      • OptionalsetFactory: SetFactory<T>

        Optional factory supplying the set used to track seen values.

      Returns Iterable<T>

      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]