New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@aptoma/timer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aptoma/timer

A module for creating timers

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
12
9.09%
Maintainers
1
Weekly downloads
 
Created
Source

@aptoma/timer

A module for timing events. Relies on process.hrtime().

Installation

npm install --save @aptoma/timer

Usage

var timer = require('@aptoma/timer');
var elapsed = timer('MyTimer');
// do stuff
console.log(elapsed());
// { name: 'MyEvent',
//   summary: 'MyEvent: 11495.606ms',
//   msec: 11495.605854,
//   hrtime: [11, 495605854]
// }

Under the hood, timer() simply records the current hrtime, and then calculates the diff whenever elapsed() is called.

The name you pass to timer() can be any valid string, and will be used in the name and summary fields of the return value of elapsed().

The name does not have to be unique, you can create as many timers as you like with the same name.

elapsed() does not stop the timer, it can be called multiple times to track various offsets from the start time.

FAQs

Package last updated on 14 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts