This package has been deprecated

Author message:

Renamed to p-time

promise-time

0.2.0 • Public • Published

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

Package Sidebar

Install

npm i promise-time

Weekly Downloads

2

Version

0.2.0

License

MIT

Last publish

Collaborators

  • sindresorhus