UNPKG
foldable
Version:
latest (0.0.1)
0.0.1
Fold iterable data
github.com/abstract-tools/foldable
abstract-tools/foldable
foldable
/
index.js
12 lines
(8 loc)
•
151 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
function fold (iter,
init
,
fun
) {
let acc =
init
for
(
const
value of iter) { acc =
fun
(acc, value)
}
return
acc } module.exports = fold