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

@nodeart/event_emitter

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodeart/event_emitter - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "@nodeart/event_emitter",
"version": "1.0.1",
"version": "1.0.2",
"description": "Simple EventEmitter pattern",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -5,5 +5,5 @@ "use strict";

return function(eventName, ...args) {
const arrOfSubscribers = this.events[eventName] || [];
args.forEach(fn => arrOfSubscribers.push({ fn: fn, once: once }));
this.events[eventName] = arrOfSubscribers;
const eventsArr = this.events[eventName] || [];
args.forEach(fn => eventsArr.push({ fn: fn, once: once }));
this.events[eventName] = eventsArr;
return this;

@@ -29,9 +29,6 @@ };

if (!this.events[eventName]) return this;
for (let i = 0; i < this.events[eventName].length; i++) {
let obj = this.events[eventName][i];
obj.fn(...args);
if (obj.once) {
this.events[eventName].splice(i, 1);
}
}
this.events[eventName] = this.events[eventName].filter(elem => {
elem.fn(...args);
return !elem.once;
});
return this;

@@ -38,0 +35,0 @@ };

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