pipe-pipefy
v1.1.0
Published
Combine functions calling each function with the output of the last one
Downloads
9
Readme
pipe-pipefy
pipe-pipefy
allows to combine functions, calling each function with the output of the last one.
Usage
import { pipe } from 'pipe-pipefy';
const getName = (person) => person.name;
const uppercase = (string) => string.toUpperCase();
const person = { name: 'Mathieu' };
const result =
pipe(
getName,
uppercase
)(person);
expect(result).toBe('MATHIEU');
import { pipe, pipefy } from 'pipe-pipefy';
const getName = (person) => person.name;
const uppercase = (string) => string.toUpperCase();
const repeat = (string, n) => string.repeat(n);
const person = { name: 'Mathieu' };
const result =
pipe(
getName,
uppercase,
pipefy(repeat, 2)
)(person);
expect(result).toBe('MATHIEUMATHIEU');
Installation
You can get pipe-pipefy
via npm.
$ npm install pipe-pipefy --save