[Pkg-javascript-commits] [node-async] 340/480: make done callback function (instead of function-expression): dont create it new on each iteration

Jonas Smedegaard js at moszumanska.debian.org
Fri May 2 08:58:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository node-async.

commit c508e5e96a82e7bbe92fbf4cc070331dae2fb072
Author: Alex Shvets <github at sashok.mk.ua>
Date:   Mon Jul 22 09:27:14 2013 +0300

    make done callback function (instead of function-expression): dont create it new on each iteration
---
 lib/async.js | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/lib/async.js b/lib/async.js
index cb6320d..f737623 100755
--- a/lib/async.js
+++ b/lib/async.js
@@ -105,19 +105,20 @@
         }
         var completed = 0;
         _each(arr, function (x) {
-            iterator(x, only_once(function (err) {
-                if (err) {
-                    callback(err);
-                    callback = function () {};
-                }
-                else {
-                    completed += 1;
-                    if (completed >= arr.length) {
-                        callback(null);
-                    }
-                }
-            }));
+            iterator(x, only_once(done) );
         });
+        function done(err) {
+          if (err) {
+              callback(err);
+              callback = function () {};
+          }
+          else {
+              completed += 1;
+              if (completed >= arr.length) {
+                  callback(null);
+              }
+          }
+        }
     };
     async.forEach = async.each;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-async.git



More information about the Pkg-javascript-commits mailing list