Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    p-timepublic

    p-time Build Status

    Measure the time a promise takes to resolve

    Install

    $ npm install --save p-time
    

    Usage

    const pTime = require('p-time');
    const execa = require('execa');
     
    const promise = pTime(execa)('sleep', ['1']);
     
    promise.then(() => {
        console.log(promise.time);
        //=> 1016
    });

    API

    pTime(input)

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

    pTime.log(input)

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

    input

    Type: Function

    Promise-returning/async function.

    Related

    License

    MIT © Sindre Sorhus

    install

    npm i p-time

    Downloadsweekly downloads

    8

    version

    1.0.0

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar