npm.io
2.0.1-beta.0 • Published 7 years ago

@icon-magic/timing

Licence
BSD-2-Clause
Version
2.0.1-beta.0
Deps
2
Size
151 kB
Vulns
0
Weekly
0

@icon-magic/timing

This package handles timing using Node.js' process.hrtime function.

Usage

// Import the timing module module
import { timer } from '@icon-magic/timing';

const TIMER = timer();

function doSomething() {
  TIMER.start();
  /* Something is getting done */
  LOGGER.info(`${TIMER.end()}`);
}

Methods

The timer object has the following methods:

To start the timer:

  • start()

To end the timer, returns elapsed time:

  • end()