@cjser/p-time
v4.0.0-cjser.2
Published
Measure the time a promise takes to resolve
Downloads
66
Maintainers
Readme
p-time
Measure the time a promise takes to resolve
Install
npm install p-timeUsage
import pTime from 'p-time';
import {execa} from 'execa';
const promise = pTime(execa)('sleep', ['1']);
await promise;
console.log(promise.time);
//=> 1016API
pTime(asyncFunction)
Returns a decorated version of asyncFunction that when called returns a Promise with a time property of the elapsed time in milliseconds.
pTime.log(asyncFunction)
Returns a decorated version of asyncFunction that when called logs the elapsed time in milliseconds of the Promise.
asyncFunction
Type: Function
Promise-returning/async function.
Related
cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/p-time
