pt

promise-time

Measure the time a promise takes to resolve

Showing:

Popularity

Downloads/wk

3

GitHub Stars

62

Maintenance

Last Commit

5mos ago

Contributors

3

Package

Dependencies

0

Size (min+gzip)

0.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Deprecated!
Renamed to p-time

Readme

promise-time Build Status

Measure the time a Promise takes to resolve

Install

$ npm install --save promise-time

Usage

const promiseTime = require('promise-time');
const execa = require('execa');

const promise = promiseTime(execa)('sleep', ['1']);

promise.then(() => {
    console.log(promise.time);
    //=> 1016
});

API

promiseTime(input)

Returns a decorated version of input that when executed returns a Promise with a time property of the elapsed time in milliseconds.

promiseTime.log(input)

Returns a decorated version of input that when executed logs the elapsed time in milliseconds of the Promise.

input

Type: Function

Promise-returning function.

License

MIT © Sindre Sorhus

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100