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

timer-function-execution

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

timer-function-execution

Measures function execution time. Supports synchronous and asynchronous functions.

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

Timer Function Execution

npm npm NPM

Timer Function Execution is a library that provides a simple way to measure the execution time of functions in JavaScript and React Native. It supports both synchronous and asynchronous functions, making it a versatile tool for developers who want to optimize their code's performance.

Installation

You can install the library using npm or yarn:

$ npm install timer-function-execution

or

$ yarn add timer-function-execution

Usage

import Timer from "timer-function-execution";

const timer = new Timer();

// Measure the execution time of a synchronous function
timer.start();
simulateSyncOperation();
timer.stop();
console.log(
  `Elapsed time for synchronous function: ${timer.getElapsedTime()} ms`
);

// Measure the execution time of an asynchronous function
await timer.measureAsync(async () => {
  // Replace this with your asynchronous function
  await simulateAsyncOperation();
});

Features

  • Measure execution time of both synchronous and asynchronous functions.
  • Support for asynchronous measurements using async/await.
  • Simple and easy-to-use API.

License

This library is open-source and available under the MIT License.

Author

Created by gusbdev

Keywords

FAQs

Package last updated on 02 Nov 2023

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