@gamepark/rules-api
Version:
API to implement the rules of a board game
11 lines • 387 B
JavaScript
export function loopWithFuse(repeat, options) {
let attempts = options?.attempts || (process.env.NODE_ENV === 'development' ? 1000 : 10000);
const errorFn = options?.errorFn || (() => new Error('Infinite loop detected'));
while (repeat()) {
if (attempts == 0) {
throw errorFn();
}
attempts--;
}
}
//# sourceMappingURL=loops.util.js.map