promise-welder
v1.0.0
Published
Promise-Welder is a promise chaining/reducing utility.
Downloads
10
Maintainers
Readme
promise-welder
Installation
Run the following command to install as a dependency in your project.
npm install promise-welder
Usage
PromiseChain: This handy utility lets you chain functions which have inter dependency and return Promise which drives the next function in the chain. An initial state is provided as part of the call. Usage Example:
const { PromiseChain } = require('promise-welder');
const A = ({ x }) => Promise.resolve({ y: x*x });
const B = ({ y }) => Promise.resolve({ z: y*2 });
const C = ({ z }) => Promise.resolve(z*10);
PromiseChain( [A, B, C], {x:2} ).then(console.log);
Output: 80
Credits
This project was bootstrapped using Nodeneeds utility.