feature(util) checkArgs speed up: for -> while

This commit is contained in:
coderaiser 2014-11-02 05:38:45 -05:00
parent 41cd8ad96c
commit 9339fb08c9

View file

@ -62,16 +62,15 @@
this.checkArgs = function(argsParam, names) {
var error,
msg = '',
i = 0,
n = names.length,
isLength = n === argsParam.length,
template = '{{ name }} coud not be empty!';
if (!isLength)
for (i = 0; i < n; i++)
if (!argsParam[i]) {
while (--n)
if (argsParam[n] === undefined) {
msg = Util.render(template, {
name: names[i]
name: names[n]
});
error = new Error(msg);