From 9339fb08c99541e68359006e4eab483bf11eb5f8 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 2 Nov 2014 05:38:45 -0500 Subject: [PATCH] feature(util) checkArgs speed up: for -> while --- lib/util.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/util.js b/lib/util.js index 9427e8ec..7dec724c 100644 --- a/lib/util.js +++ b/lib/util.js @@ -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);