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

eventflow

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

eventflow - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

22

eventflow.js

@@ -32,13 +32,27 @@ var async = require('async'),

name = args.shift(),
callback = args.pop(),
callback = typeof args[args.length -1] === 'function' ? args.pop() : null,
listeners = emitter.listeners(name);
function handleError (err) {
if (callback) {
callback(err);
}
else {
throw err;
}
}
if (!listeners.length) {
callback(new Error('Tried to invoke `' + name + '` but there were no listeners'));
handleError(new Error('Tried to invoke `' + name + '` but there were no listeners'));
}
else if (listeners.length > 1) {
callback(new Error('Tried to invoke `' + name + '` but there were ' + listeners.length + ' listners'));
handleError(new Error('Tried to invoke `' + name + '` but there were ' + listeners.length + ' listners'));
}
else {
asyncApply(emitter, listeners[0], args, callback);
if (callback) {
asyncApply(emitter, listeners[0], args, callback);
}
else {
return listeners[0].apply(emitter, args);
}
}

@@ -45,0 +59,0 @@ };

2

package.json
{
"name": "eventflow",
"version": "0.0.7",
"version": "0.0.8",
"description": "Flow control for your event emitters",

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

@@ -222,3 +222,10 @@ var eventflow = require('../'),

});
it('should support synchronous invoke', function () {
emitter.on('sync', function () {
return 'isSync';
});
assert.equal(emitter.invoke('sync'), 'isSync');
});
});
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