New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kgo

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kgo - npm Package Compare versions

Comparing version 0.1.2 to 1.0.0

16

kgo.js
var run = require('./run'),
EventEmitter = require('events').EventEmitter,
fnRegex = /^function.*?\((.*?)\)/;

@@ -30,13 +31,4 @@

};
kgoFn.errors = function(handlers){
errorHandlers = handlers;
};
function kgoError(name, error){
var handler = errorHandlers[name];
if(handler){
handler(error);
}
for(var key in EventEmitter.prototype){
kgoFn[key] = EventEmitter.prototype[key];
}

@@ -47,3 +39,3 @@

setTimeout(function(){
run(tasks, results, kgoError);
run(tasks, results, kgoFn);
},0);

@@ -50,0 +42,0 @@

{
"name": "kgo",
"version": "0.1.2",
"version": "1.0.0",
"description": "Flow control the super easy way",

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

@@ -93,11 +93,11 @@ kgo

You can assign error handlers to your functions by name, if you want to.
kgo has EventEmitter methods on it, so you can bind to 'error'
The handler gets passed the error, and the name of the step that returned the error.
kgo
(calles)
(more calles)
.errors({
'stuff':function(error){
// will recieve the Whoops error.
}
(calls)
(more calls)
.on('error', function(error, stepName){
});

@@ -59,3 +59,3 @@ function Step(task, args, done){

function run(tasks, results, throwError){
function run(tasks, results, emitter){
var currentTask;

@@ -74,3 +74,3 @@

if(error){
throwError(name, error);
emitter.emit('error', error, name);
return;

@@ -80,3 +80,3 @@ }

results[name] = result;
run(tasks, results, throwError);
run(tasks, results, emitter);
}

@@ -87,3 +87,3 @@ );

function cloneAndRun(tasks, results, throwError){
function cloneAndRun(tasks, results, emitter){
var todo = {};

@@ -95,5 +95,5 @@

run(todo, results, throwError);
run(todo, results, emitter);
}
module.exports = cloneAndRun;

@@ -52,2 +52,17 @@ var test = require('grape'),

});
});
test('errors', function(t){
t.plan(2);
kgo('things', function(cb){
doAsync(cb, null, 1);
})('stuff', ['things'], function(things, cb){
cb(new Error('stuff screwed up'));
})(['stuff'], function(stuff, cb){
t.equal(stuff, 3);
}).on('error', function(error, name){
t.equal(name, 'stuff');
t.equal(error.message, 'stuff screwed up');
});
});
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