Skip to content

hypescript/promise-peek

Repository files navigation

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}`))
  

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published