constant export const __ = typeof Symbol === 'function' ? Symbol ( 'curriable placeholder' ) : 0xedd1 ; function description param fn param arity param args returns export function getCurried < Fn extends Handler > ( fn , arity ) { function _curried ( args ) { return function ( ) { const length = args . length ; const newArgs = arguments ; const { length : newArgsLength } = newArgs ; const combined = [ ] ; let newArgsIndex = 0 ; let remaining = arity ; let value ; if ( length ) { let index = - 1 ; while ( ++ index < length ) { combined [ index ] = value = args [ index ] === __ && newArgsIndex < newArgsLength ? newArgs [ newArgsIndex ++ ] : args [ index ] ; if ( value !== __ ) { -- remaining ; } } } if ( newArgsIndex < newArgsLength ) { while ( newArgsIndex < newArgsLength ) { combined [ combined . length ] = value = newArgs [ newArgsIndex ] ; if ( value !== __ && newArgsIndex < arity ) { -- remaining ; } ++ newArgsIndex ; } } return remaining > 0 ? _curried ( combined ) : fn . apply ( this , combined ) ; } ; } return _curried ( [ ] ) ; }