param delay export const wait = ( delay ) => new Promise ( ( resolve ) => setTimeout ( resolve , delay ) ) ; export const retry = ( task , delay , retries = Number . POSITIVE_INFINITY ) => new Promise ( ( resolve , reject ) => task ( ) . then ( resolve ) . catch ( ( reason ) => retries > 0 ? wait ( delay ) . then ( retry . bind ( null , task , delay , retries - 1 ) ) . then ( resolve ) . catch ( reject ) : reject ( reason ) ) ) ; export const isDefined = < T > ( value ) : value is NonNullable < T > => value != null ;