0.2.0 • Published 8 years ago

promise-time v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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