0.0.8 • Published 6 years ago

@devmastery/pipe v0.0.8

Weekly downloads
32
License
MIT
Repository
-
Last release
6 years ago

@devmastery/pipe

An implementation of a pipe function that works with a mix of promises and non-promises.

pipe is a function that receives a list of functions and returns a new function that executes the given list from left to right passing the result from each previous function to the next.

For example:

const promiseToAddOne = async x => x + 1
const double = x => x * 2
const promiseToDouble = async x => x * 2
const addOneThenDoubleTwice = pipe(
    promiseToAddOne,
    double,
    promiseToDouble
)
addOneThenDoubleTwice(1).then(console.log) // logs 8
0.0.8

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

1.0.0

6 years ago