1.0.0 • Published 3 years ago

uinix-fp-pipe v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

uinix-fp-pipe

Build Coverage Downloads Size

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 transforming X through the series of functions.

License

MIT © Chris Zhou