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

emmett

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

emmett - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

4

emmett.js

@@ -143,3 +143,3 @@ (function() {

for (event in a)
Emitter.prototype.on.call(this, event, a[event], c);
Emitter.prototype.on.call(this, event, a[event], b);

@@ -463,3 +463,3 @@ // Variant 4:

*/
Emitter.version = '2.1.0';
Emitter.version = '2.1.1';

@@ -466,0 +466,0 @@

/**
* emmett - A custom events emitter for Node.js and the browser
* @version v2.1.0
* @version v2.1.1
* @link https://github.com/jacomyal/emmett
* @license MIT
*/
(function(){"use strict";var e={once:"boolean",scope:"object"},t=function(){this._enabled=!0,this._children=[],this._handlers={},this._handlersAll=[]};t.prototype.on=function(n,r,i){var h,s,l,o,d,a;if("function"==typeof r){for(d="string"==typeof n?[n]:n,h=0,s=d.length;h!==s;h+=1)if(o=d[h]){this._handlers[o]||(this._handlers[o]=[]),a={handler:r};for(l in i||{}){if(!e[l])throw new Error('The option "'+l+'" is not recognized by Emmett.');a[l]=i[l]}this._handlers[o].push(a)}}else if(n&&"object"==typeof n&&!Array.isArray(n))for(o in n)t.prototype.on.call(this,o,n[o],i);else{if("function"!=typeof n)throw new Error("Wrong arguments.");a={handler:n};for(l in i||{}){if(!e[l])throw new Error('The option "'+l+'" is not recognized by Emmett.');a[l]=i[l]}this._handlersAll.push(a)}return this},t.prototype.once=function(e,t,n){if("function"==typeof t)n=n||{},n.once=!0,this.on(e,t,n);else{if((!e||"object"!=typeof e||Array.isArray(e))&&"function"!=typeof e)throw new Error("Wrong arguments.");t=t||{},t.once=!0,this.on(e,t)}return this},t.prototype.off=function(e,t){var n,r,i,h,s,l,o,d="string"==typeof e?[e]:e;if(1===arguments.length&&"function"==typeof d){t=arguments[0];for(s in this._handlers){for(l=[],n=0,r=this._handlers[s].length;n!==r;n+=1)this._handlers[s][n].handler!==t&&l.push(this._handlers[s][n]);this._handlers[s]=l}for(l=[],n=0,r=this._handlersAll.length;n!==r;n+=1)this._handlersAll[n].handler!==t&&l.push(this._handlersAll[n]);this._handlersAll=l}else if(2===arguments.length)for(n=0,r=d.length;n!==r;n+=1){if(o=d[n],this._handlers[o]){for(l=[],i=0,h=this._handlers[o].length;i!==h;i+=1)this._handlers[o][i].handler!==t&&l.push(this._handlers[o][i]);this._handlers[o]=l}this._handlers[o]&&0===this._handlers[o].length&&delete this._handlers[o]}return this},t.prototype.unbindAll=function(){var e;this._handlersAll=[];for(e in this._handlers)delete this._handlers[e];return this},t.prototype.emit=function(e,t){var n,r,i,h,s,l,o,d,a,f="string"==typeof e?[e]:e;if(!this._enabled)return this;for(t=void 0===t?{}:t,n=0,r=f.length;n!==r;n+=1)if(a=f[n],d=(this._handlers[a]||[]).concat(this._handlersAll),d.length){for(l={type:a,data:t||{},target:this},s=[],i=0,h=d.length;i!==h;i+=1)d[i].handler.call("scope"in d[i]?d[i].scope:this,l),d[i].once||s.push(d[i]);this._handlers[a]=s}for(n=0,r=this._children.length;n!==r;n+=1)o=this._children[n],o.emit.apply(o,arguments);return this},t.prototype.child=function(){var e=this,n=new t;return n.on("emmett:kill",function(){if(e._children)for(var t=0,r=e._children.length;r>t;t++)if(e._children[t]===n){e._children.splice(t,1);break}}),this._children.push(n),n},t.prototype.kill=function(){if(this.emit("emmett:kill"),this.unbindAll(),this._handlers=null,this._handlersAll=null,this._enabled=!1,this._children)for(var e=0,t=this._children.length;t>e;e++)this._children[e].kill();this._children=null},t.prototype.disable=function(){return this._enabled=!1,this},t.prototype.enable=function(){return this._enabled=!0,this},t.version="2.1.0","undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=t),exports.Emitter=t):"function"==typeof define&&define.amd?define("emmett",[],function(){return t}):this.Emitter=t}).call(this);
(function(){"use strict";var e={once:"boolean",scope:"object"},t=function(){this._enabled=!0,this._children=[],this._handlers={},this._handlersAll=[]};t.prototype.on=function(n,r,i){var h,s,l,o,d,a;if("function"==typeof r){for(d="string"==typeof n?[n]:n,h=0,s=d.length;h!==s;h+=1)if(o=d[h]){this._handlers[o]||(this._handlers[o]=[]),a={handler:r};for(l in i||{}){if(!e[l])throw new Error('The option "'+l+'" is not recognized by Emmett.');a[l]=i[l]}this._handlers[o].push(a)}}else if(n&&"object"==typeof n&&!Array.isArray(n))for(o in n)t.prototype.on.call(this,o,n[o],r);else{if("function"!=typeof n)throw new Error("Wrong arguments.");a={handler:n};for(l in i||{}){if(!e[l])throw new Error('The option "'+l+'" is not recognized by Emmett.');a[l]=i[l]}this._handlersAll.push(a)}return this},t.prototype.once=function(e,t,n){if("function"==typeof t)n=n||{},n.once=!0,this.on(e,t,n);else{if((!e||"object"!=typeof e||Array.isArray(e))&&"function"!=typeof e)throw new Error("Wrong arguments.");t=t||{},t.once=!0,this.on(e,t)}return this},t.prototype.off=function(e,t){var n,r,i,h,s,l,o,d="string"==typeof e?[e]:e;if(1===arguments.length&&"function"==typeof d){t=arguments[0];for(s in this._handlers){for(l=[],n=0,r=this._handlers[s].length;n!==r;n+=1)this._handlers[s][n].handler!==t&&l.push(this._handlers[s][n]);this._handlers[s]=l}for(l=[],n=0,r=this._handlersAll.length;n!==r;n+=1)this._handlersAll[n].handler!==t&&l.push(this._handlersAll[n]);this._handlersAll=l}else if(2===arguments.length)for(n=0,r=d.length;n!==r;n+=1){if(o=d[n],this._handlers[o]){for(l=[],i=0,h=this._handlers[o].length;i!==h;i+=1)this._handlers[o][i].handler!==t&&l.push(this._handlers[o][i]);this._handlers[o]=l}this._handlers[o]&&0===this._handlers[o].length&&delete this._handlers[o]}return this},t.prototype.unbindAll=function(){var e;this._handlersAll=[];for(e in this._handlers)delete this._handlers[e];return this},t.prototype.emit=function(e,t){var n,r,i,h,s,l,o,d,a,f="string"==typeof e?[e]:e;if(!this._enabled)return this;for(t=void 0===t?{}:t,n=0,r=f.length;n!==r;n+=1)if(a=f[n],d=(this._handlers[a]||[]).concat(this._handlersAll),d.length){for(l={type:a,data:t||{},target:this},s=[],i=0,h=d.length;i!==h;i+=1)d[i].handler.call("scope"in d[i]?d[i].scope:this,l),d[i].once||s.push(d[i]);this._handlers[a]=s}for(n=0,r=this._children.length;n!==r;n+=1)o=this._children[n],o.emit.apply(o,arguments);return this},t.prototype.child=function(){var e=this,n=new t;return n.on("emmett:kill",function(){if(e._children)for(var t=0,r=e._children.length;r>t;t++)if(e._children[t]===n){e._children.splice(t,1);break}}),this._children.push(n),n},t.prototype.kill=function(){if(this.emit("emmett:kill"),this.unbindAll(),this._handlers=null,this._handlersAll=null,this._enabled=!1,this._children)for(var e=0,t=this._children.length;t>e;e++)this._children[e].kill();this._children=null},t.prototype.disable=function(){return this._enabled=!1,this},t.prototype.enable=function(){return this._enabled=!0,this},t.version="2.1.1","undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=t),exports.Emitter=t):"function"==typeof define&&define.amd?define("emmett",[],function(){return t}):this.Emitter=t}).call(this);
{
"name": "emmett",
"version": "2.1.0",
"version": "2.1.1",
"description": "A custom events emitter for Node.js and the browser",

@@ -5,0 +5,0 @@ "main": "emmett.js",

# Emmett - a custom events emitter for Node.js and the browser
**version: 2.1.0**
**version: 2.1.1**

@@ -4,0 +4,0 @@ ## Description

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