Simplify and refactor code while preserving functionality and library constraints.
Simplify and refactor $ARGUMENTS.
.claude/docs/libraries/For each complexity issue:
Apply changes following these patterns:
Early Return:
// Before
function process(value: number | null): Result | null {
if (value !== null) {
if (value > 0) {
return doSomething(value);
}
}
return null;
}
// After
function process(value: number | null): Result | null {
if (value === null) return null;
if (value <= 0) return null;
return doSomething(value);
}
Extract Function:
// Before
function main() {
// 50 lines of mixed concerns
}
// After
function main() {
const data = loadData();
const result = processData(data);
saveResult(result);
}
bunx vitest run