UNPKG

eas-cli

Version:
22 lines (21 loc) 651 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.retryIfNullAsync = exports.waitAsync = void 0; async function waitAsync(duration) { await new Promise(resolve => setTimeout(resolve, duration)); } exports.waitAsync = waitAsync; async function retryIfNullAsync(method, options = {}) { let { tries = 5, delay = 1000 } = options; while (tries > 0) { const value = await method(); if (value !== null) { return value; } tries--; options.onRetry?.(tries); await waitAsync(delay); } return null; } exports.retryIfNullAsync = retryIfNullAsync;