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

emmett

Package Overview
Dependencies
Maintainers
2
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 3.1.0 to 3.1.1

44

emmett.js

@@ -51,2 +51,26 @@ (function() {

/**
* Iterate over an object that may have ES6 Symbols.
*
* @param {object} object Object on which to iterate.
* @param {function} fn Iterator function.
* @param {object} [scope] Optional scope.
*/
function forIn(object, fn, scope) {
var symbols,
k,
i,
l;
for (k in object)
fn.call(scope || null, k, object[k]);
if (Object.getOwnPropertySymbols) {
symbols = Object.getOwnPropertySymbols(object);
for (i = 0, l = symbols.length; i < l; i++)
fn.call(scope || null, symbols[i], object[symbols[i]]);
}
}
/**
* The emitter's constructor. It initializes the handlers-per-events store and

@@ -170,4 +194,6 @@ * the global handlers store.

if (isPlainObject(a)) {
for (event in a)
this.on(event, a[event], b);
forIn(a, function(name, fn) {
this.on(name, fn, b);
}, this);
return this;

@@ -194,3 +220,3 @@ }

// Defining the list in which the handler should be inserted
if (typeof event === 'string' || typeof event === 'symbol') {
if (typeof event === 'string' || typeof event === 'symbol') {
if (!this._handlers[event])

@@ -330,3 +356,3 @@ this._handlers[event] = [];

else if (arguments.length === 1 &&
(typeof events === 'string' || typeof events === 'symbol')) {
(typeof events === 'string' || typeof events === 'symbol')) {
delete this._handlers[events];

@@ -351,4 +377,3 @@ }

else if (isPlainObject(events)) {
for (k in events)
this.off(k, events[k]);
forIn(events, this.off, this);
}

@@ -419,6 +444,3 @@

if (isPlainObject(events)) {
for (var k in events)
this.emit(k, events[k]);
forIn(events, this.emit, this);
return this;

@@ -523,3 +545,3 @@ }

*/
Emitter.version = '3.1.0';
Emitter.version = '3.1.1';

@@ -526,0 +548,0 @@

/**
* emmett - A custom event emitter for Node.js and the browser.
* @version v3.1.0
* @version v3.1.1
* @link https://github.com/jacomyal/emmett
* @license MIT
*/
(function(){"use strict";function t(t,e){var n,r={};for(n in t)r[n]=t[n];for(n in e)r[n]=e[n];return r}function e(t){return!(!t||"object"!=typeof t||Array.isArray(t)||t instanceof Function||t instanceof RegExp)}function n(t,e){t=t||[];var n,r,s=[];for(r=0,n=t.length;n>r;r++)t[r].fn!==e&&s.push(t[r]);return s}var r={once:"boolean",scope:"object"},s=0,i=function(){this._enabled=!0,this.unbindAll()};i.prototype.unbindAll=function(){return this._handlers={},this._handlersAll=[],this._handlersComplex=[],this},i.prototype.on=function(t,n,i){var l,o,h,a,f,p,d;if(e(t)){for(a in t)this.on(a,t[a],n);return this}for("function"==typeof t&&(i=n,n=t,t=null),f=[].concat(t),l=0,o=f.length;o>l;l++){if(a=f[l],d={order:s++,fn:n},"string"==typeof a||"symbol"==typeof a)this._handlers[a]||(this._handlers[a]=[]),p=this._handlers[a],d.type=a;else if(a instanceof RegExp)p=this._handlersComplex,d.pattern=a;else{if(null!==a)throw Error("Emitter.on: invalid event.");p=this._handlersAll}for(h in i||{})r[h]&&(d[h]=i[h]);p.push(d)}return this},i.prototype.once=function(){var n=Array.prototype.slice.call(arguments),r=n.length-1;return e(n[r])&&n.length>1?n[r]=t(n[r],{once:!0}):n.push({once:!0}),this.on.apply(this,n)},i.prototype.off=function(t,r){var s,i,l,o;if(1===arguments.length&&"function"==typeof t){r=arguments[0];for(l in this._handlers)this._handlers[l]=n(this._handlers[l],r),0===this._handlers[l].length&&delete this._handlers[l];this._handlersAll=n(this._handlersAll,r),this._handlersComplex=n(this._handlersComplex,r)}else if(1!==arguments.length||"string"!=typeof t&&"symbol"!=typeof t){if(2===arguments.length){var h=[].concat(t);for(s=0,i=h.length;i>s;s++)o=h[s],this._handlers[o]=n(this._handlers[o],r),0===(this._handlers[o]||[]).length&&delete this._handlers[o]}else if(e(t))for(l in t)this.off(l,t[l])}else delete this._handlers[t];return this},i.prototype.listeners=function(t){var e,n,r,s=this._handlersAll||[],i=!1;if(!t)throw Error("Emitter.listeners: no event provided.");for(s=s.concat(this._handlers[t]||[]),n=0,r=this._handlersComplex.length;r>n;n++)e=this._handlersComplex[n],~t.search(e.pattern)&&(i=!0,s.push(e));return this._handlersAll.length||i?s.sort(function(t,e){return t.order-e.order}):s.slice(0)},i.prototype.emit=function(t,n){if(!this._enabled)return this;if(e(t)){for(var r in t)this.emit(r,t[r]);return this}var s,i,l,o,h,a,f,p,d=[].concat(t),u=[];for(h=0,f=d.length;f>h;h++){for(l=this.listeners(d[h]),a=0,p=l.length;p>a;a++)o=l[a],s={type:d[h],target:this},arguments.length>1&&(s.data=n),o.fn.call("scope"in o?o.scope:this,s),o.once&&u.push(o);for(a=u.length-1;a>=0;a--)i=u[a].type?this._handlers[u[a].type]:u[a].pattern?this._handlersComplex:this._handlersAll,i.splice(i.indexOf(u[a]),1)}return this},i.prototype.kill=function(){this.unbindAll(),this._handlers=null,this._handlersAll=null,this._handlersComplex=null,this._enabled=!1,this.unbindAll=this.on=this.once=this.off=this.emit=this.listeners=Function.prototype},i.prototype.disable=function(){return this._enabled=!1,this},i.prototype.enable=function(){return this._enabled=!0,this},i.version="3.1.0","undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=i),exports.Emitter=i):"function"==typeof define&&define.amd?define("emmett",[],function(){return i}):this.Emitter=i}).call(this);
(function(){"use strict";function t(t,e){var n,r={};for(n in t)r[n]=t[n];for(n in e)r[n]=e[n];return r}function e(t){return!(!t||"object"!=typeof t||Array.isArray(t)||t instanceof Function||t instanceof RegExp)}function n(t,e,n){var r,s,i,l;for(s in t)e.call(n||null,s,t[s]);if(Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(t),i=0,l=r.length;l>i;i++)e.call(n||null,r[i],t[r[i]])}function r(t,e){t=t||[];var n,r,s=[];for(r=0,n=t.length;n>r;r++)t[r].fn!==e&&s.push(t[r]);return s}var s={once:"boolean",scope:"object"},i=0,l=function(){this._enabled=!0,this.unbindAll()};l.prototype.unbindAll=function(){return this._handlers={},this._handlersAll=[],this._handlersComplex=[],this},l.prototype.on=function(t,r,l){var o,h,a,f,p,u,d;if(e(t))return n(t,function(t,e){this.on(t,e,r)},this),this;for("function"==typeof t&&(l=r,r=t,t=null),p=[].concat(t),o=0,h=p.length;h>o;o++){if(f=p[o],d={order:i++,fn:r},"string"==typeof f||"symbol"==typeof f)this._handlers[f]||(this._handlers[f]=[]),u=this._handlers[f],d.type=f;else if(f instanceof RegExp)u=this._handlersComplex,d.pattern=f;else{if(null!==f)throw Error("Emitter.on: invalid event.");u=this._handlersAll}for(a in l||{})s[a]&&(d[a]=l[a]);u.push(d)}return this},l.prototype.once=function(){var n=Array.prototype.slice.call(arguments),r=n.length-1;return e(n[r])&&n.length>1?n[r]=t(n[r],{once:!0}):n.push({once:!0}),this.on.apply(this,n)},l.prototype.off=function(t,s){var i,l,o,h;if(1===arguments.length&&"function"==typeof t){s=arguments[0];for(o in this._handlers)this._handlers[o]=r(this._handlers[o],s),0===this._handlers[o].length&&delete this._handlers[o];this._handlersAll=r(this._handlersAll,s),this._handlersComplex=r(this._handlersComplex,s)}else if(1!==arguments.length||"string"!=typeof t&&"symbol"!=typeof t)if(2===arguments.length){var a=[].concat(t);for(i=0,l=a.length;l>i;i++)h=a[i],this._handlers[h]=r(this._handlers[h],s),0===(this._handlers[h]||[]).length&&delete this._handlers[h]}else e(t)&&n(t,this.off,this);else delete this._handlers[t];return this},l.prototype.listeners=function(t){var e,n,r,s=this._handlersAll||[],i=!1;if(!t)throw Error("Emitter.listeners: no event provided.");for(s=s.concat(this._handlers[t]||[]),n=0,r=this._handlersComplex.length;r>n;n++)e=this._handlersComplex[n],~t.search(e.pattern)&&(i=!0,s.push(e));return this._handlersAll.length||i?s.sort(function(t,e){return t.order-e.order}):s.slice(0)},l.prototype.emit=function(t,r){if(!this._enabled)return this;if(e(t))return n(t,this.emit,this),this;var s,i,l,o,h,a,f,p,u=[].concat(t),d=[];for(h=0,f=u.length;f>h;h++){for(l=this.listeners(u[h]),a=0,p=l.length;p>a;a++)o=l[a],s={type:u[h],target:this},arguments.length>1&&(s.data=r),o.fn.call("scope"in o?o.scope:this,s),o.once&&d.push(o);for(a=d.length-1;a>=0;a--)i=d[a].type?this._handlers[d[a].type]:d[a].pattern?this._handlersComplex:this._handlersAll,i.splice(i.indexOf(d[a]),1)}return this},l.prototype.kill=function(){this.unbindAll(),this._handlers=null,this._handlersAll=null,this._handlersComplex=null,this._enabled=!1,this.unbindAll=this.on=this.once=this.off=this.emit=this.listeners=Function.prototype},l.prototype.disable=function(){return this._enabled=!1,this},l.prototype.enable=function(){return this._enabled=!0,this},l.version="3.1.1","undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=l),exports.Emitter=l):"function"==typeof define&&define.amd?define("emmett",[],function(){return l}):this.Emitter=l}).call(this);
{
"name": "emmett",
"version": "3.1.0",
"version": "3.1.1",
"description": "A custom event emitter for Node.js and the browser.",

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

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