"use strict";

/*
* Creates a version of λ that cannot be executed concurrently.
*
* Returns the Promise returned by λ.
*/
module.exports = λ => {
    let locked  = false;
    let promise = null;

    return () => {
        if (locked) {
            return promise;
        }

        locked = true;

        promise = λ().then(
            results => {
                locked = false;

                return results;
            },

            error => {
                locked = false;

                return Promise.reject(error);
            }
        );

        return promise;
    };
};

"use strict";

/*
* Creates a version of λ that cannot be executed concurrently.
*
* Expects λ to take no arguments and to return a Promise.
* When concurrent calls get cancelled, the wrapping function returns
* undefined. Otherwise, it returns the Promise returned by λ.
*/
module.exports = λ => {
    let locked = false;

    return () => {
        if (locked) {
            return;
        }

        locked = true;

        λ().then(
            results => {
                locked = false;

                return results;
            },

            error => {
                locked = false;

                return Promise.reject(error);
            }
        );
    };
};

--- 
+++ 
@@ -3,21 +3,20 @@
 /*
 * Creates a version of λ that cannot be executed concurrently.
 *
-* Expects λ to take no arguments and to return a Promise.
-* When concurrent calls get cancelled, the wrapping function returns
-* undefined. Otherwise, it returns the Promise returned by λ.
+* Returns the Promise returned by λ.
 */
 module.exports = λ => {
-    let locked = false;
+    let locked  = false;
+    let promise = null;
 
     return () => {
         if (locked) {
-            return;
+            return promise;
         }
 
         locked = true;
 
-        λ().then(
+        promise = λ().then(
             results => {
                 locked = false;
 
@@ -30,5 +29,7 @@
                 return Promise.reject(error);
             }
         );
+
+        return promise;
     };
 };
Change return value of noConcurrentCalls to make it return the promise return by λ
