flip-fn

1.0.0 • Public • Published

flip

Build Status

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

Package Sidebar

Install

npm i flip-fn

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • conorhastings