import { Flip } from './types' import { apply } from '../apply' import { curry } from '../curry' /** * Flips the first 2 arguments of a function. * @name flip(fn: (a: A, b: B) => C): Curry2 */ export const flip: Flip = function flip(f: (a: A, b: B, ...args: Array) => C) { return curry(function(b: B, a: A, ...args: Array): C { return apply([a, b, ...args], f) }) }