index.d.ts 485 B

12345678910111213141516171819202122
  1. /**
  2. Check whether a request can be retried based on the `error.code`.
  3. @param error - The `.code` property, if it exists, will be used to determine whether retry is allowed.
  4. @example
  5. ```
  6. import isRetryAllowed = require('is-retry-allowed');
  7. isRetryAllowed({code: 'ETIMEDOUT'});
  8. //=> true
  9. isRetryAllowed({code: 'ENOTFOUND'});
  10. //=> false
  11. isRetryAllowed({});
  12. //=> true
  13. ```
  14. */
  15. declare function isRetryAllowed(error?: Error | Record<string, unknown>): boolean;
  16. export = isRetryAllowed;