Comparing version 0.0.4 to 0.0.5
@@ -43,17 +43,4 @@ var async = require('async'); | ||
function countArgs (fn) { | ||
var regex = /function(?:\s+\w+\s*|\s*)\(([^\)]*)\)/i; | ||
var args = fn.toString().match(regex)[1].trim(); | ||
if (args.length) { | ||
return args.split(',').length; | ||
} | ||
else { | ||
return 0; | ||
} | ||
} | ||
eventflow.countArgs = countArgs; | ||
function asyncApply (thisArg, fn, args, done) { | ||
var count = countArgs(fn); | ||
if (count <= args.length) { | ||
if (fn.length <= args.length) { | ||
done(null, fn.apply(thisArg, args)); | ||
@@ -60,0 +47,0 @@ } |
{ | ||
"name": "eventflow", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Flow control for your event emitters", | ||
@@ -5,0 +5,0 @@ "main": "eventflow.js", |
@@ -7,21 +7,2 @@ var eventflow = require('../'), | ||
describe('countArgs()', function () { | ||
it('should return 0 for a function with no arguments', function () { | ||
function zero () {} | ||
assert.equal(eventflow.countArgs(zero), 0); | ||
}); | ||
it('should return 1 for a function with one argument', function () { | ||
function one (foo) {} | ||
assert.equal(eventflow.countArgs(one), 1); | ||
}); | ||
it('should return 5 for a function with five arguments', function () { | ||
function five (foo, bar, baz,boo, far) {} | ||
assert.equal(eventflow.countArgs(five), 5); | ||
}); | ||
}); | ||
describe('series', function() { | ||
@@ -28,0 +9,0 @@ var emitter, result; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
12988
244