Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Compare values of the same type rather than relying on loose equality
Validate and normalize compatible domain values before comparison; do not blindly coerce both sides.
Bad example
| 1 | if (ticker.milistreamId === req.query.id) { /* number === string is always false */ } |
Explanation (EN)
A number and its textual representation are unequal under strict equality.
Objašnjenje (HR)
Good example
| 1 | const id = parseValidId(req.query.id); |
| 2 | if (ticker.milistreamId === id) { /* matching identifier */ } |
Explanation (EN)
The shared parser rejects malformed/repeated query values and returns the same ID representation used by the model.
Objašnjenje (HR)
Notes (EN)
Validate boundary values and normalize them into the same domain representation before equality checks.
Exceptions / Tradeoffs (EN)
String coercion can hide arrays, null or malformed IDs; Number can collapse empty strings and lose large integer precision. A type assertion is not conversion.