promise-time
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);
});
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