Skip to content
Grammar
ECMAScript
Deadline
2,000 ms
Runtime
Browser

Estimate JavaScript cyclomatic complexity by function

Count branch decisions and maximum decision nesting for the program and each function.

Local processingNo sign-upNever executed

Input

The report separates the program and every function it contains.

Local

Complexity report

Submit the example or replace it with your own input. Source is parsed but never executed.

What this tool proves

Explicit static behavior

Each scope starts at one path, then adds branches for conditionals, loops, catches, tested switch cases, ternaries, and short-circuit logical operators.

Complexity is a transparent static heuristic

Each scope starts at one path, then adds branches for conditionals, loops, catches, tested switch cases, ternaries, and short-circuit logical operators.

Nested functions are measured independently and excluded from their parent's count. The metric is a review aid, not a quality verdict.

Static analysis has a deliberate safety boundary

Tool Swim parses source as standard ECMAScript inside a disposable Web Worker with a 2,000 ms deadline. It never calls eval, Function, imported modules, or user code.

Source and results stay in the current browser tab. The public tool makes no API request, stores no preset, and does not require an account or telemetry.

Primary references

Questions and answers

Related JavaScript tools