All files / src/tools estimate-1rm.ts

100% Statements 6/6
100% Branches 9/9
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15            1x 23x 23x   23x   17x 17x  
/**
 * Estimate one-rep max using the Epley formula.
 * Formula: weight × (1 + reps / 30)
 *
 * For reps = 1, returns the weight directly (it already is a 1RM).
 */
export function estimate1rm(weight_kg: number, reps: number): number {
  if (weight_kg <= 0) throw new Error('weight_kg must be positive');
  if (reps <= 0 || !Number.isInteger(reps)) throw new Error('reps must be a positive integer');
 
  if (reps === 1) return weight_kg;
 
  return weight_kg * (1 + reps / 30);
}