1.0.0 • Published 5 years ago

promise-welder v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

promise-welder

Build Status npm latest version Maintainability Test Coverage

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

Chandra Shekar Chennamsetty

This project was bootstrapped using Nodeneeds utility.