1.0.0 • Published 3 years ago
uinix-fp-pipe v1.0.0
uinix-fp-pipe
uinix-fp
pipe utility.
Install
This package is ESM-only and requires Node 12+.
npm install uinix-fp-pipe
Use
pipe
allows chaining a sequence of functions in a pipeline.
import {pipe} from 'uinix-fp-pipe';
const greet = x => 'hello ' + x;
const uppercase = x => x.toUpperCase();
const exclaim = x => x + '!';
const shout = pipe([
greet,
uppercase,
exclaim
]); // curried
shout('Jesse'); // 'HELLO JESSE!'
API
This package exports the following identifiers: pipe
. There is no default export.
pipe(fs)(x)
Parameters (Curried)
fs
(Function[]
) — An array of functions.x
(X
) — The input.
Returns
Y
— Output of transformingX
through the series of functions.
License
1.0.0
3 years ago