New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

event-horizon

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-horizon - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

4

event-horizon.js

@@ -9,3 +9,3 @@ /*global module*/

return {
run: function (func) {
run: function (func, eatenCB) {
var diff = new Date().getTime() - startTime;

@@ -17,2 +17,4 @@ counter += 1;

func();
} else {
eatenCB();
}

@@ -19,0 +21,0 @@ } else {

{
"name": "event-horizon",
"version": "0.0.0",
"version": "0.0.1",
"description": "Stay below a certain number of things per second",

@@ -5,0 +5,0 @@ "main": "event-horizon.js",

@@ -9,15 +9,19 @@ /*global require, describe, it, console*/

it('should eat things that happen too fast', function () {
var t = horizon.instance({ window: 1000, max: 5 }),
c = 0,
i = 0;
var t = horizon.instance({ window: 1000, max: 5 }),
run = 0,
eaten = 0,
i = 0;
for (i = 1; i < 100; i += 1) {
for (i = 1; i < 101; i += 1) {
t.run(function () {
console.log('test' + i);
c += 1;
run += 1;
}, function () {
eaten += 1;
});
}
assert.equal(4, c);
assert.equal(4, run);
assert.equal(96, eaten);
});
});
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