Skip to content

scan

scan<A, B>(initial, f): (data) => readonly B[]

Defined in: Utils/Arr.ts:634

Like reduce, but returns every intermediate accumulator as an array. The initial value is not included — the output has the same length as the input.

A

B

B

(acc, a) => B

(data): readonly B[]

readonly A[]

readonly B[]

pipe([1, 2, 3], Arr.scan(0, (acc, n) => acc + n)); // [1, 3, 6]