mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(util) checkArgs speed up: for -> while
This commit is contained in:
parent
41cd8ad96c
commit
9339fb08c9
1 changed files with 3 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue