You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Björn b963b3396c
init
4 years ago
..
index.js init 4 years ago
license init 4 years ago
package.json init 4 years ago
readme.md init 4 years ago

readme.md

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 = str => Promise.resolve(`${str} Unicorn`);
const addRainbow = str => Promise.resolve(`${str} Rainbow`);

const pipeline = pPipe(addUnicorn, addRainbow);

pipeline('❤️').then(console.log);
//=> '❤️ Unicorn Rainbow'

API

pPipe(input, …)

The input functions are applied from left to right.

You can also specify an array as the first argument instead of multiple function arguments. Mostly only useful if you have to support Node.js 4. With Node.js 6 and above you can just use spread syntax.

input

Type: Function

Expected to return a Promise or any value.

  • 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