export function retryOnReject < T > ( f , maxRetries ) { let retries = 0 ; const g = async ( ) => { try { return await f ( ) ; } catch ( err ) { if ( retries < maxRetries ) { retries ++ ; return g ( ) ; } else { throw err ; } } } ; return g ( ) ; }