1.0.1 • Published 7 years ago

es6-promise-peek v1.0.1

Weekly downloads
19
License
MIT
Repository
github
Last release
7 years ago

es6-promise-peek

Adds a 'peek' function to es6 promises

Easily peek into a promise chain, without affecting the returned value.

Install

$ yarn add es6-promise-peek

or

$ npm install --save es6-promise-peek

Usage

Promise.resolve("a")
    .peek(console.log)
    .then(console.log)
    .then(console.log)
// => "a"
// => "a"
// => undefined

NB: Return values from the function passed to peek are ignored - even if they are promises.

Environments

This has only been tested on nodejs 6.

Dependencies

License

MIT © Alastair Brayne