Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Simplify a callback that only checks truthiness
Simplify to truthiness only when zero, false and other falsy values should also be excluded.
Bad example
| 1 | rows.some(row => Boolean(row[key])); |
Explanation (EN)
An explicit predicate is redundant only when it already expresses truthiness.
Objašnjenje (HR)
Good example
| 1 | rows.some(row => row[key]); |
Explanation (EN)
some coerces the callback result to boolean; this deliberately tests truthiness, not mere presence.
Objašnjenje (HR)
Notes (EN)
Return a value directly as a predicate only when the intended exclusion set is exactly JavaScript falsy values.
Exceptions / Tradeoffs (EN)
A check excluding only null, undefined and empty string still admits zero and false. Replacing it with truthiness changes semantics for those inputs.