Rule: prefer-switch
Prefer a switch
statement to an if
statement with simple ===
comparisons.
Config
An optional object with the property ‘min-cases’. This is the number cases needed before a switch statement is recommended. Defaults to 3.
Config examples
"prefer-switch": true
"prefer-switch": [true, {"min-cases": 2}]
Schema
{ "type": "object", "properties": { "min-cases": { "type": "number" } } }