Skip to content

GroupBy

8 exports Added in v2.0.0 Source

Constructors

make

Added in v2.0.0 Source

Constructs a GroupBy from a Stream.

Signature

declare const make: <K, V, E, R>(
  grouped: Stream.Stream<readonly [K, Queue.Dequeue<Take.Take<V, E>>], E, R>,
) => GroupBy<K, V, E, R>;

Destructors

evaluate

Added in v2.0.0 Source

Run the function across all groups, collecting the results in an arbitrary order.

Signature

declare const evaluate: {
  <K, V, E, A, E2, R2>(
    f: (key: K, stream: Stream<V, E, never>) => Stream<A, E2, R2>,
    options?: {
      readonly bufferSize?: number;
    },
  ): <R>(self: GroupBy<K, V, E, R>) => Stream<A, E | E2, R2 | R>;
  <K, V, E, R, A, E2, R2>(
    self: GroupBy<K, V, E, R>,
    f: (key: K, stream: Stream<V, E, never>) => Stream<A, E2, R2>,
    options?: {
      readonly bufferSize?: number;
    },
  ): Stream<A, E | E2, R | R2>;
};

Models

GroupBy interface

Added in v2.0.0 Source

Representation of a grouped stream. This allows to filter which groups will be processed. Once this is applied all groups will be processed in parallel and the results will be merged in arbitrary order.

Signature

interface GroupBy<out K, out V, out E = never, out R = never>
  extends Variance<K, V, E, R>, Pipeable {
  readonly grouped: Stream<readonly [K, Dequeue<Take<V, E>>], E, R>;
}

Other

GroupBy

Added in v2.0.0 Source

Symbols

Signature

declare const GroupByTypeId: unique symbol;

GroupByTypeId type

Added in v2.0.0 Source

Signature

type GroupByTypeId = typeof GroupByTypeId;

Utils

filter

Added in v2.0.0 Source

Filter the groups to be processed.

Signature

declare const filter: {
  <K>(
    predicate: Predicate<NoInfer<K>>,
  ): <V, E, R>(self: GroupBy<K, V, E, R>) => GroupBy<K, V, E, R>;
  <K, V, E, R>(self: GroupBy<K, V, E, R>, predicate: Predicate<K>): GroupBy<K, V, E, R>;
};

first

Added in v2.0.0 Source

Only consider the first n groups found in the Stream.

Signature

declare const first: {
  (n: number): <K, V, E, R>(self: GroupBy<K, V, E, R>) => GroupBy<K, V, E, R>;
  <K, V, E, R>(self: GroupBy<K, V, E, R>, n: number): GroupBy<K, V, E, R>;
};