es6-promise-peek

1.0.1 • Public • Published

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]

Dependencies (0)

    Dev Dependencies (10)

    Package Sidebar

    Install

    npm i es6-promise-peek

    Weekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • builtbybrayne