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

@joezerg/counter-processing-time

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

@joezerg/counter-processing-time

Starts a counter to measure the execution time of a function

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

Counter Processing Time

Package zero dependencies to measure the execution time of a function.

Install

yarn add @joezerg/counter-processing-time

or

npm i @joezerg/counter-processing-time

Usage

import { ProcessingTimeCalculator } from "@joezerg/counter-processing-time";

function SomeFunction() {
  const timeCounter = new ProcessingTimeCalculator();

  setTimeout(() => {
    const elapsedTime = timeCounter.stop(); // => always return time in milliseconds or seconds
    console.log(elapsedTime); // => 2000
  }, 2000);
}

Options

import {
  ProcessingTimeCalculator,
  TimeUnit,
} from "@joezerg/counter-processing-time";

function SomeFunction() {
  const timeCounter = new ProcessingTimeCalculator({
    message: "Some tag to identified the counter",
    timeUnit: TimeUnit.SECONDS,
  });

  setTimeout(() => {
    timeCounter.stop(); // Log Output => "Some tag to identified the counter | 2 seconds"
  }, 2000);
}
ParameterTypeDescription
messagestring (optional)message to attach to the log promt
timeUnitTimeUnit enum (optional)Set the Time meassure unit to return or log, Defautl is milliseconds

Keywords

time

FAQs

Package last updated on 28 Sep 2022

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