Last active
July 22, 2016 12:49
-
-
Save vlas-ilya/60b106ff8cb6c15eeb9a69afcfe03fd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
function _toConsumableArray(arr) { | |
if (Array.isArray(arr)) { | |
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { | |
arr2[i] = arr[i]; | |
} | |
return arr2; | |
} else { | |
return Array.from(arr); | |
} | |
} | |
var flip = function flip(fn) { | |
return function () { | |
for (var _len = arguments.length, params = Array(_len), _key = 0; _key < _len; _key++) { | |
params[_key] = arguments[_key]; | |
} | |
return fn.apply(undefined, _toConsumableArray(params.reverse())); | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var flip = fn => (...params) => fn(...params.reverse()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment