Skip to content
Buy me a coffee

Integrator

Integrator: object

Defined in: src/stream/Gatherers.ts:19

Factories for Integrator.

ofGreedy: <A, T, R>(fn) => Integrator<A, T, R>

Returns a greedy Integrator wrapping fn: it consumes all input and only the downstream may stop it (it returns what downstream.push returns, or true). Greedy lets the engine skip short-circuit checks, and a greedy integrator is never mistaken for an initializer by Gatherer.ofSequential. Like the reference, null is returned as-is.

A

T

R

(state, element, downstream) => boolean

Integrator<A, T, R>

of<A, T, R>(integrator): Integrator<A, T, R>

Returns the given function as an Integrator that may stop the upstream by returning false. The function is returned unchanged (like the reference, no null check).

A

T

R

(state, element, downstream) => boolean

Integrator<A, T, R>