3.0.1 • Published 7 years ago

at-every-turn v3.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

At Every Turn

Do something at every step in your promise chain.

Installation

npm install --save at-every-turn

Usage

Pass a function and an initial promise to atEveryTurn. The function will be executed against the result of each promise in the ensuing promise chain - including the initial promise.

For example, executing this code:

const atEveryTurn = require('at-every-turn');

atEveryTurn(console.log, Promise.resolve(0))
  .then((x) => x + 1)
  .then((x) => x + 1);

Will produce this console output:

0
1
2

All promise behaviour is handled, including: catch, the use of then with onFulfilled and onRejected params, rejection of a then and rejection of the initial promise.

3.0.1

7 years ago

3.0.0

7 years ago

2.0.0

7 years ago

1.0.0

7 years ago