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

asyncemit

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asyncemit - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

25

index.js
'use strict';
var prefix = require('eventemitter3').prefixed
, toString = Object.prototype.toString
, slice = Array.prototype.slice
/**
* Get an accurate type description of whatever we receive.
*
* @param {Mixed} what What ever we receive
* @returns {String} Description of what ever it is.
* @api private
*/
function type(what) {
return toString.call(what).slice(8, -1).toLowerCase();
}
/**
* Asynchronously emit an event.

@@ -13,3 +28,3 @@ *

module.exports = function asyncemit() {
var args = Array.prototype.slice.call(arguments, 0)
var args = slice.call(arguments, 0)
, event = args.shift()

@@ -21,7 +36,7 @@ , async = args.length

listeners = (this._events || {})['~'+ event] || [];
if (listeners && !Array.isArray(listeners)) {
listeners = [ listeners ];
}
listeners = (this._events || {})[prefix ? '~'+ event : event];
if (!listeners) return fn(), this;
if (type(listeners) !== 'array') listeners = [ listeners ];
/**

@@ -28,0 +43,0 @@ * Simple async helper utility.

6

package.json
{
"name": "asyncemit",
"version": "2.0.0",
"version": "3.0.0",
"description": "Asynchronously emit event an event based on the arguments length.",

@@ -33,7 +33,9 @@ "main": "index.js",

"assume": "1.2.x",
"eventemitter3": "1.0.x",
"istanbul": "0.3.x",
"mocha": "2.2.x",
"pre-commit": "1.0.x"
},
"peerDependencies": {
"eventemitter3": ">=1.1.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