46
Replace Inline Code with Function Call
Goal
When inline code reproduces what a named function already does, the inline copy is replaced by a call.
Before the refactoring
const inRange = candidate >= low && candidate <= high;After the refactoringconst inRange = between(candidate, low, high);Savings
One canonical implementation; the name labels the intent; future improvements to the function reach every site that used to inline.
Note
If the existing function's name doesn't quite match the local intent, the call site reads as a near-miss; consider Change Function Declaration first.