1.0.1 • Published 6 years ago

promise-peek v1.0.1

Weekly downloads
9
License
MIT
Repository
github
Last release
6 years ago

Promise peek

Build Status Coverage Status MIT license

Augmentation to ES6 Promise, that allows to peek at the promise results without interfering.

Using this module in other modules

In order to augment your Promises with the peek method, you'll need to import this module:

import "promise-peek";

new Promise((resolve, reject) => dice('1d6') === 6 ? reject('Fail!') : resolve('Success!'))
    .peek(console.info, console.error)
    .then(result => console.log(`It's a ${result}`))
    .catch(error => console.log(`It's a ${error}`))