flip-fn
v1.0.0
Published
flips first two arguments to a function and calls the rest of the arguments in order
Downloads
3
Maintainers
Readme
flip
Takes function as argument and returns a new function that will call original function with first two arguments flipped. Higher order functions like this can be seen in languages like Elm
and Haskell
use
function x(a, b) {
return a - b;
}
var flipX = flip(x);
x(2, 1) //returns 1
flipX(2, 1) //returns -1