[Pkg-javascript-commits] [node-async] 38/480: return value from functions in async.apply

Jonas Smedegaard js at moszumanska.debian.org
Fri May 2 08:58:10 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 8cbd4eb9e5b7a1a4c0cd6e825346baa03896769d
Author: Caolan McMahon <caolan at caolanmcmahon.com>
Date:   Mon Aug 16 22:47:59 2010 +0100

    return value from functions in async.apply
---
 lib/async.js       | 4 +++-
 test/test-async.js | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/async.js b/lib/async.js
index e07ce6d..24e6279 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -390,7 +390,9 @@
     async.apply = function(fn){
         var args = Array.prototype.slice.call(arguments, 1);
         return function(){
-            fn.apply(null, args.concat(Array.prototype.slice.call(arguments)));
+            return fn.apply(
+                null, args.concat(Array.prototype.slice.call(arguments))
+            );
         };
     };
 
diff --git a/test/test-async.js b/test/test-async.js
index abeafd5..de03d88 100644
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -732,7 +732,7 @@ exports['sortBy'] = function(test){
 };
 
 exports['apply'] = function(test){
-    test.expect(5);
+    test.expect(6);
     var fn = function(){
         test.same(Array.prototype.slice.call(arguments), [1,2,3,4])
     };
@@ -741,6 +741,10 @@ exports['apply'] = function(test){
     async.apply(fn, 1, 2)(3, 4);
     async.apply(fn, 1)(2, 3, 4);
     async.apply(fn)(1, 2, 3, 4);
+    test.equals(
+        async.apply(function(name){return 'hello ' + name}, 'world')(),
+        'hello world'
+    );
     test.done();
 };
 

-- 
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