Skip to content

Commit

Permalink
Fixed the uncurry function
Browse files Browse the repository at this point in the history
  • Loading branch information
Odd Marthon Lende committed Oct 22, 2017
1 parent 5542130 commit 9987121
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
15 changes: 8 additions & 7 deletions lib/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,14 @@ module.exports = function (_ref) {
// Uncurries a function; used to allow the f(x,y,z) style on exports.
var uncurry = function uncurry(f) {
return function (a, b, c, d, e) {
var p;
// Hardcoded because efficiency (`arguments` is very slow).
if (typeof a !== "undefined") f = f(a);
if (typeof b !== "undefined") f = f(b);
if (typeof c !== "undefined") f = f(c);
if (typeof d !== "undefined") f = f(d);
if (typeof e !== "undefined") f = f(e);
return f;
if (typeof a !== "undefined") p = f(a);
if (typeof b !== "undefined") p = f(b);
if (typeof c !== "undefined") p = f(c);
if (typeof d !== "undefined") p = f(d);
if (typeof e !== "undefined") p = f(e);
return p;
};
};

Expand Down Expand Up @@ -621,4 +622,4 @@ module.exports = function (_ref) {
fromString: fromString,
toString: toString
};
};
};
13 changes: 7 additions & 6 deletions src/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,14 @@ module.exports = ({

// Uncurries a function; used to allow the f(x,y,z) style on exports.
const uncurry = f => (a,b,c,d,e) => {
var p;
// Hardcoded because efficiency (`arguments` is very slow).
if (typeof a !== "undefined") f = f(a);
if (typeof b !== "undefined") f = f(b);
if (typeof c !== "undefined") f = f(c);
if (typeof d !== "undefined") f = f(d);
if (typeof e !== "undefined") f = f(e);
return f;
if (typeof a !== "undefined") p = f(a);
if (typeof b !== "undefined") p = f(b);
if (typeof c !== "undefined") p = f(c);
if (typeof d !== "undefined") p = f(d);
if (typeof e !== "undefined") p = f(e);
return p;
};

// () -> Promise Bool
Expand Down

0 comments on commit 9987121

Please sign in to comment.