Socket
Socket
Sign inDemoInstall

timer-function-execution

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    timer-function-execution

Measures function execution time. Supports synchronous and asynchronous functions.


Version published
Weekly downloads
6
decreased by-33.33%
Maintainers
1
Install size
349 kB
Created
Weekly downloads
 

Readme

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

Last updated on 02 Nov 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc