UNPKG
stream-chain
Version:
latest (4.2.2)
4.2.2
4.2.1
4.2.0
4.1.1
4.1.0
4.0.2
4.0.1
4.0.0
3.6.3
3.6.2
3.6.1
3.6.0
3.5.1
3.5.0
3.4.1
3.4.0
3.3.2
3.3.1
3.3.0
3.2.0
3.1.0
3.0.1
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.1.0
2.0.3
2.0.2
2.0.1
2.0.0
1.0.3
1.0.2
1.0.1
1.0.0
Chain functions as transform streams.
github.com/uhop/stream-chain
uhop/stream-chain
stream-chain
/
src
/
utils
/
scan.js
14 lines
(10 loc)
•
276 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// @ts-self-types="./scan.d.ts"
'use strict'
;
const
scan
= (
fn, acc
) =>
value
=>
{
const
result =
fn
(acc, value);
if
(result &&
typeof
result.
then
==
'function'
) {
return
result.
then
(
result
=>
(acc = result)); }
return
(acc = result); };
module
.
exports
= scan;