MCPcopy Create free account
hub / github.com/Effect-TS/effect / reduce

Function reduce

packages/effect/src/Sink.ts:1388–1394  ·  view source on GitHub ↗
(initial: LazyArg<S>, f: (s: S, input: In) => S)

Source from the content-addressed store, hash-verified

1386 * @since 4.0.0
1387 */
1388export const reduce = <S, In>(initial: LazyArg<S>, f: (s: S, input: In) => S): Sink<S, In> =>
1389 reduceArray(initial, (s, arr) => {
1390 for (let i = 0; i < arr.length; i++) {
1391 s = f(s, arr[i])
1392 }
1393 return s
1394 })
1395
1396/**
1397 * A sink that reduces its inputs using the provided function `f` starting from

Callers 2

trie.tsFile · 0.85
compactFunction · 0.85

Calls 2

reduceArrayFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected