fn-pipe
Pipe pattern for composing your functions in order to complete the required process in much readable way
Introduction
Pipe is a function where you can pass multiple functions with first function payload and this payload will be passed from function to function in order to complete the required process.
Normal pipe Example
It is very easy to read and write a single pipe like below.
; const numbers = 1 2 3 4 5; const newNumbers = numbers // return [5, 7, 9, 11, 13]
So in real world you can simply compose your functions in pipe like below
; const userPipe = userId
Promise pipe Example
In pipe, if any function has promise so pipe will return a new promise
; // if you have a promise const myPromise = { iftrue else } // then you have a normal function const myOwnFn = { return num } // then pipe const numbers = 1 2 3 4 5; const promise = numbers // return new promise promise // [1, 2, 3, 4]
Installation
Run the below command to install using NPM
npm install --save fn-pipe
Contribution
Feel free to fork, extend, create issues, create PRs or spread the word.