Comparing version 1.0.0 to 1.1.0
19
index.js
@@ -33,3 +33,20 @@ var errTo = require('errto'); | ||
function autoesc(func) { | ||
return function autoesc_decorated() { | ||
if (typeof(func) !== 'function') { | ||
throw new Error('autoesc requires a function'); | ||
} | ||
switch (func.length) { | ||
case 1: return function (cb) { return autoesc_decorated.apply(this, arguments); }; | ||
case 2: return function (a, cb) { return autoesc_decorated.apply(this, arguments); }; | ||
case 3: return function (a, b, cb) { return autoesc_decorated.apply(this, arguments); }; | ||
case 4: return function (a, b, c, cb) { return autoesc_decorated.apply(this, arguments); }; | ||
case 5: return function (a, b, c, d, cb) { return autoesc_decorated.apply(this, arguments); }; | ||
case 6: return function (a, b, c, d, e, cb) { return autoesc_decorated.apply(this, arguments); }; | ||
case 7: return function (a, b, c, d, e, f, cb) { return autoesc_decorated.apply(this, arguments); }; | ||
case 8: return function (a, b, c, d, e, f, g, cb) { return autoesc_decorated.apply(this, arguments); }; | ||
case 9: return function (a, b, c, d, e, f, g, h, cb) { return autoesc_decorated.apply(this, arguments); }; | ||
default: | ||
return autoesc_decorated; | ||
} | ||
function autoesc_decorated() { | ||
var args = Array.prototype.slice.call(arguments, 0); | ||
@@ -36,0 +53,0 @@ if (args.length === 0) throw new Error('autoesc function requires at least one argument (a Node-style callback)'); |
{ | ||
"name": "autoesc", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Error Short Circuiter (ESC) function decorator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
8357
57