Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

p-pipe

2.0.1 • Public • Published

p-pipe Build Status

Compose promise-returning & async functions into a reusable pipeline

Install

$ npm install p-pipe

Usage

const pPipe = require('p-pipe');
 
const addUnicorn = async string => `${string} Unicorn`;
const addRainbow = async string => `${string} Rainbow`;
 
const pipeline = pPipe(addUnicorn, addRainbow);
 
(async () => {
    console.log(await pipeline('❤️'));
    //=> '❤️ Unicorn Rainbow'
})();

API

pPipe(input…)

The input functions are applied from left to right.

input

Type: Function

Expected to return a Promise or any value.

Related

  • p-each-series - Iterate over promises serially
  • p-series - Run promise-returning & async functions in series
  • p-waterfall - Run promise-returning & async functions in series, each passing its result to the next
  • More…

License

MIT © Sindre Sorhus

install

npm i p-pipe

Downloadsweekly downloads

779,507

version

2.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability