fix(util) checkArgs: add length check first

This commit is contained in:
coderaiser 2014-08-27 09:26:51 -04:00
parent f56a175101
commit 1f810293ff

View file

@ -131,17 +131,19 @@
msg = '',
i = 0,
n = names.length,
isLength = n === argsParam.length,
template = '{{ name }} coud not be empty!';
for (i = 0; i < n; i++)
if (!argsParam[i]) {
msg = Util.render(template, {
name: names[i]
});
error = new Error(msg);
throw(error);
}
if (!isLength)
for (i = 0; i < n; i++)
if (!argsParam[i]) {
msg = Util.render(template, {
name: names[i]
});
error = new Error(msg);
throw(error);
}
return this;
};