Comparing version 0.9.0 to 0.9.1
@@ -91,12 +91,4 @@ (function(root, factory) { | ||
var args = Array.prototype.slice.call(arguments); | ||
var firstPreconditions = preconditions[0]; | ||
var result; | ||
var result = matchPreconditions(args, preconditions); | ||
if(is.array(firstPreconditions[0])) { | ||
result = matchArray(args, firstPreconditions[0][0]); | ||
} | ||
else { | ||
result = matchRegular(args, preconditions); | ||
} | ||
if(result.fail) { | ||
@@ -115,19 +107,3 @@ return warnPost('precondition', result.fail, name, args); | ||
function matchArray(args, precondition) { | ||
var fails = args.filter(function(arg) { | ||
return !precondition(arg) && precondition; | ||
}); | ||
if(fails.length) { | ||
return { | ||
fail: fails[0] | ||
}; | ||
} | ||
return { | ||
i: 0 | ||
}; | ||
} | ||
function matchRegular(args, preconditions) { | ||
function matchPreconditions(args, preconditions) { | ||
var i, j, len1, len2, precondition, pre, allMatched; | ||
@@ -161,2 +137,18 @@ | ||
function matchArray(args, precondition) { | ||
var fails = args.filter(function(arg) { | ||
return !precondition(arg) && precondition; | ||
}); | ||
if(fails.length) { | ||
return { | ||
fail: fails[0] | ||
}; | ||
} | ||
return { | ||
i: 0 | ||
}; | ||
} | ||
function arr(pre) { | ||
@@ -163,0 +155,0 @@ return function(i) { |
@@ -5,9 +5,10 @@ { | ||
"author": "Juho Vepsalainen <bebraw@gmail.com>", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"dependencies": { | ||
"annois": "~0.3.0" | ||
"annois": "0.3.0" | ||
}, | ||
"devDependencies": { | ||
"suite.js": "== 0.6.0", | ||
"funkit": "== 0.7.7" | ||
"suite.js": "0.6.0", | ||
"funkit": "0.7.8", | ||
"annogenerate": "~0.6.2" | ||
}, | ||
@@ -14,0 +15,0 @@ "scripts": { |
@@ -73,2 +73,17 @@ var suite = require('suite.js'); | ||
var testObject = annotate('testObject', 'Tests object parameter after array') | ||
.on([is.array], function(o) { | ||
return o.reduce(function(a, b) { | ||
return a + b; | ||
}); | ||
}) | ||
.on(is.object, function(o) { | ||
return 'object'; | ||
}) | ||
suite(testObject, [ | ||
[[1, 2, 3]], 6, | ||
{a: 5}, 'object' | ||
]); | ||
var clamp = annotate('clamp', 'Clamps given number between given bounds') | ||
@@ -75,0 +90,0 @@ .on(is.number, is.number, function(a, args) { |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14129
9
315
0
3
+ Addedannois@0.3.0(transitive)
- Removedannois@0.3.2(transitive)
Updatedannois@0.3.0