Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elapsy

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elapsy

Elapsy is a singleton class that calculates the elapsed time from the moment the first instance until the moment one of the possible functions is called.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

elapsy

Elapsy is a singleton class that calculates the elapsed time from the moment the first instance until the moment one of the possible functions is called.

Install

npm install --save elapsy

Usage

In order to use elapsy, you need to instantiate the class when you want to start counting the time. EG right after you start your application

const Elapsy = require('elapsy');

// This will mark the current time for the next calls
const elapsy = new Elapsy();

When you want to check the execution time, you can use one of the following functions:

time

Returns the number of the execution time in miliseconds

const elapsy = new Elapsy();

const elapsed = elapsy.time();
console.log(elapsed);

formated

Returns a formated string of the execution time in the format hh:mm:ss:ms.

If the elapsed time is more than a day, the number of days is show in the start of the string.

Examples:

00:13:08.324

03:00:59.999

1 day, 12:43:17.385

428 days, 04:58:23.032

const elapsy = new Elapsy();

const formatedElapsed = elapsy.formated();
console.log(formatedElapsed);

log

Insert the formated (hh:mm:ss.ms) string of the current elapsed time in the right end of the terminal.

You can pass a chalk color to the method (default is blue) and if you want to show the miliseconds;

Example:

const elapsy = new Elapsy();

elapsy.log('white', false);

Keywords

FAQs

Package last updated on 22 Jul 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc