npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

elaps

v2.4.0

Published

Stopwatch for high-resolution timing

Readme

elaps v2.3.2

Stopwatch for high-resolution timing

Powered by process.hrtime()

const elaps = require('elaps');

// create a started timer
let t = elaps('do something');

// create a stopped timer
t = elaps.lazy('do something');

// choose where the elapsed time is printed
elaps('did something in %t').stop(true);

// print the number of laps
elaps('did something %n times').stop(true);

// util.format placeholders are supported
elaps('do something: %O', {meta:'data'}).stop(true);

// args without a placeholder default to %O
elaps('do something:', {meta:'data'}).stop(true);

Stopwatch class

Properties

lap: ?Lap

The newest Lap object created by a start() call.

Equals null when the newest lap is stopped.

laps: number[]

The array of lap times in order of stop time.

elapsed: number

The time passed (in milliseconds) with 1+ laps counting.

Updated when a pause() or stop() call leads to this.pending being zero.

Note: This not the same as sum(), which combines the individual lap times.

pending: number

The number of pending laps (neither paused nor stopped).

msg: string

The message passed to the elaps constructor.

Printed by stop(true) and print() calls.

Use %t to print the elapsed time.

Use %n to print the number of laps.

log: Function

The function called by the print method.

Defaults to elaps.log || console.log.

 

Methods

start(): Lap

Start a new lap.

Update the value of this.lap to the new lap.

stop(print: ?boolean): this

Stop the current lap.

Pass true to print the lap time.

print(time: ?number): this

Print this.msg with given time (in milliseconds) or this.elapsed.

You can pass a string (followed by any other values) to override this.msg for one call only. To override both the time and message, the time must come first.

time(): number

Get the updated value of this.elapsed without pausing/stopping every pending lap.

sum(): number

Get the combined time (in milliseconds) of all stopped laps.

average(): number

Get the average time (in milliseconds) of all stopped laps.

pause(): this

Shorthand for this.lap.pause()

resume(): this

Shorthand for this.lap.resume()

reset(): this

Reset this to its initial state.

Any pending laps won't affect the new state.

 

Lap class

Properties

elapsed: number

The lap time. Updated by pause() and stop() calls.

paused: boolean

Equals true when paused. 😉

timer: ?Stopwatch

The associated Stopwatch object.

Equals null once stopped.

 

Methods

stop(print: ?boolean): this

Stop counting.

Pass true to print the lap time.

time(): number

Get the updated value of this.elapsed without pausing/stopping.

pause(): this

Pause counting and allow for resuming in the future.

resume(): this

Resume counting.