@gamepark/rules-api
Version:
API to implement the rules of a board game
15 lines • 643 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.loopWithFuse = void 0;
function loopWithFuse(repeat, options) {
var attempts = (options === null || options === void 0 ? void 0 : options.attempts) || (process.env.NODE_ENV === 'development' ? 1000 : 10000);
var errorFn = (options === null || options === void 0 ? void 0 : options.errorFn) || (function () { return new Error('Infinite loop detected'); });
while (repeat()) {
if (attempts == 0) {
throw errorFn();
}
attempts--;
}
}
exports.loopWithFuse = loopWithFuse;
//# sourceMappingURL=loops.util.js.map