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.3 to 1.0.4

10

dist/index.js

@@ -20,4 +20,2 @@ "use strict";

return function (eventName) {
var eventsArr = this.events[eventName] || [];
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

@@ -27,6 +25,6 @@ args[_key - 1] = arguments[_key];

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

@@ -33,0 +31,0 @@ };

2

dist/index.min.js

@@ -1,1 +0,1 @@

"use strict";!function t(n,e,r){function o(f,u){if(!e[f]){if(!n[f]){var s="function"==typeof require&&require;if(!u&&s)return s(f,!0);if(i)return i(f,!0);throw new Error("Cannot find module '"+f+"'")}var h=e[f]={exports:{}};n[f][0].call(h.exports,function(t){var e=n[f][1][t];return o(e?e:t)},h,h.exports,t,n,e,r)}return e[f].exports}for(var i="function"==typeof require&&require,f=0;f<r.length;f++)o(r[f]);return o}({1:[function(t,n,e){function r(){this.events={}}var o=function(t){return function(n){for(var e=this.events[n]||[],r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.forEach(function(n){return e.push({fn:n,once:t})}),this.events[n]=e,this}},i=o(!1),f=o(!0);r.prototype.on=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return i.apply(this,n)},r.prototype.once=function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];return f.apply(this,n)},r.prototype.emit=function(t){for(var n=arguments.length,e=Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return this.events[t]?(this.events[t]=this.events[t].filter(function(t){return t.fn.apply(t,e),!t.once}),this):this},r.prototype.off=function(t){for(var n=arguments.length,e=Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return this.events[t]?(e.length>0?this.events[t]=this.events[t].filter(function(t){return!e.includes(t.fn)}):delete this.events[t],this):this},r.prototype.offAll=function(){return this.events={},this},void 0!==n&&n.exports&&(n.exports=r),"undefined"!=typeof window&&document&&(window.EventEmitter=r)},{}]},{},[1]);
"use strict";!function t(e,n,r){function o(u,f){if(!n[u]){if(!e[u]){var s="function"==typeof require&&require;if(!f&&s)return s(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var h=n[u]={exports:{}};e[u][0].call(h.exports,function(t){var n=e[u][1][t];return o(n?n:t)},h,h.exports,t,e,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(t,e,n){function r(){this.events={}}var o=function(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return this.events[e]=r.reduce(function(e,n){return e.push({fn:n,once:t}),e},this.events[e]||[]),this}},i=o(!1),u=o(!0);r.prototype.on=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i.apply(this,e)},r.prototype.once=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return u.apply(this,e)},r.prototype.emit=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return this.events[t]?(this.events[t]=this.events[t].filter(function(t){return t.fn.apply(t,n),!t.once}),this):this},r.prototype.off=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return this.events[t]?(n.length>0?this.events[t]=this.events[t].filter(function(t){return!n.includes(t.fn)}):delete this.events[t],this):this},r.prototype.offAll=function(){return this.events={},this},void 0!==e&&e.exports&&(e.exports=r),"undefined"!=typeof window&&document&&(window.EventEmitter=r)},{}]},{},[1]);
{
"name": "@nodeart/event_emitter",
"version": "1.0.3",
"version": "1.0.4",
"description": "Simple EventEmitter pattern",

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

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

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

@@ -10,0 +11,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