param fn param args signature example-raw category export function purry ( fn , args , lazy ? ) { const diff = fn . length - args . length ; const arrayArgs = Array . from ( args ) ; if ( diff === 0 ) { return fn ( ... arrayArgs ) ; } if ( diff === 1 ) { const ret = ( data ) => fn ( data , ... arrayArgs ) ; if ( lazy || fn . lazy ) { ret . lazy = lazy || fn . lazy ; ret . lazyArgs = args ; } return ret ; } throw new Error ( 'Wrong number of arguments' ) ; }