fp-pipe-then

1.0.1 • Public • Published

pipe-then

A better implementation of the "pipe" FP function that allows for piping both synchronous and asynchronous functions.

Installation:

yarn add pipe-then

or

npm install --save pipe-then

Example:

import pipe from 'pipe-then';

const double = x => x * 2;
const square = x => x * x;
const plus3 = x => new Promise(resolve => setTimeout(() => resolve(x + 3), 100));

pipe(plus3, square, double)(2)
  .then(result => // Result equals 50)
  .catch(console.error);

Package Sidebar

Install

npm i fp-pipe-then

Weekly Downloads

13

Version

1.0.1

License

ISC

Last publish

Collaborators

  • jperasmus