Estimate cyclomatic complexity for JavaScript or TypeScript functions from decision tokens.
The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.
Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.
The source is scanned for function declarations and indicators such as if, loops, case, catch, ternary, and logical operators. Each function starts at one, increments for matched decisions, and is assigned a triage band.
function validate(x) {
if (x > 0 && x < 100) {
return true;
} else if (x === 0) {
return null;
}
return false;
}
Cyclomatic Complexity Analysis Total: 6 Global scope: 1 Functions: 1 Per-function breakdown: validate (line 1): 5 Legend: 1-5 = simple, 6-10 = moderate, 11+ = complex
Refactor reviews, CI trend reports, and teaching examples compare control-flow complexity.