promise-welder

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i promise-welder

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

57.9 kB

Total Files

27

Last publish

Collaborators

  • chandu1310