Skip to main content Link Search Menu Expand Document (external link)

GroupBy.ts overview

Since v2.0.0


Exports Grouped by Category


constructors

make

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>

Source

Since v2.0.0

destructors

evaluate

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.Stream<V, E, never>) => Stream.Stream<A, E2, R2>,
    options?: { readonly bufferSize?: number | undefined } | undefined
  ): <R>(self: GroupBy<K, V, E, R>) => Stream.Stream<A, E | E2, R2 | R>
  <K, V, E, R, A, E2, R2>(
    self: GroupBy<K, V, E, R>,
    f: (key: K, stream: Stream.Stream<V, E, never>) => Stream.Stream<A, E2, R2>,
    options?: { readonly bufferSize?: number | undefined } | undefined
  ): Stream.Stream<A, E | E2, R | R2>
}

Source

Since v2.0.0

models

GroupBy (interface)

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

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

Source

Since v2.0.0

symbols

GroupByTypeId

Signature

declare const GroupByTypeId: unique symbol

Source

Since v2.0.0

GroupByTypeId (type alias)

Signature

type GroupByTypeId = typeof GroupByTypeId

Source

Since v2.0.0

utils

GroupBy (namespace)

Source

Since v2.0.0

Variance (interface)

Signature

export interface Variance<out K, out V, out E, out R> {
  readonly [GroupByTypeId]: {
    readonly _K: Covariant<K>
    readonly _V: Covariant<V>
    readonly _E: Covariant<E>
    readonly _R: Covariant<R>
  }
}

Source

Since v2.0.0

filter

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>
}

Source

Since v2.0.0

first

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>
}

Source

Since v2.0.0