Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript
285 B
Raw Blame
// Retries fn up to times attempts; returns the first result that passes check.
function withRetry(fn, times, check = () => true) {
  let last;
  for (let i = 0; i < times; i++) {
    last = fn();
    if (check(last)) return last;
  }
  return last;
}

module.exports = { withRetry };