module import type { VariadicFunction } from './../types/function' ; export type BinaryFunction = ( a : any , b : any ) => any ; export type FirstParameter < Function extends VariadicFunction > = Parameters < Function > [ 0 ] ; export type SecondParameter < Function extends VariadicFunction > = Parameters < Function > [ 1 ] ; export default function permutation2 < Function extends BinaryFunction > ( fn , shouldCurry ? ) { return ( ... args ) => { const [ a1 , b ] = args ; return shouldCurry ?. ( a1 , b ) || args . length < fn . length ? ( a2 ) => fn ( a2 , a1 ) : fn ( a1 , b ) ; } ; }