UNPKG
iter-tools-es
Version:
latest (7.5.4)
7.5.4
7.5.3
7.5.2
7.5.1
7.5.0
7.4.0
7.3.3
7.3.2
7.3.1
7.3.0
7.2.2
7.2.1
7.2.0
7.1.4
7.1.3
7.1.2
7.1.1
7.1.0
7.0.2
7.0.1
7.0.0
The iterable toolbox
github.com/iter-tools/iter-tools
iter-tools/iter-tools
iter-tools-es
/
impls
/
pipe
/
pipe.js
8 lines
(6 loc)
•
169 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
const
identity
= x => x;
function
pipe
(
...fns
) {
if
(!fns.
length
) fns = [identity];
return
fns.
reduce
(
(
f, g
) =>
(
...args
) =>
g
(
f
(...args))); }
exports
.
pipe
= pipe;