Socket
Socket
Sign inDemoInstall

event-counter

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    event-counter

Event Counter for node.js


Version published
Weekly downloads
1
Maintainers
1
Install size
4.22 kB
Created
Weekly downloads
 

Readme

Source

EventCounter

This is a JavaScript library that helps record (any kind of) incremental events, and query the number of events during the specific spantime.

Install

npm install event-counter

Example

const EventCounter = require('event-counter');

const eventCounter = EventCounter();
eventCounter.increment();
eventCounter.increment();
eventCounter.increment();

// query the number of the events ocurred in last 1 sec
eventCounter.query(1000);   // return 3

// after 10 seconds ...
eventCounter.increment();
eventCounter.increment();

// query the number of the events ocurred in last 1 sec
eventCounter.query(1000);  // retrun 2

Test

git clone https://github.com/zlargon/EventCounter.git

# npm
npm install
npm test        # unit test
npm run cover   # generate code coverage report to ./coverage/lcov-report/index.html

Licence

MIT

FAQs

Last updated on 08 Jan 2020

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