Boolean(ctx.session.authorized)
instead36 if (await blacklist.check(ctx.ip)) {
37 const scanResult = await waf.scan(ctx)
38 if (!scanResult) {
39 if (!!ctx.session.authorized || !config.pow) {40 if (config.rate_limit) {
41 await Object.assign(
42 ctx.session,
Prefer using explicit casts by calling Number
, Boolean
, or String
over using operators like +
, !!
or "" +
.
This is considered best practice as it improves readability.
const b = !!foo;
// The `+` operator does not change the value of its operand
// unless it's already a number.
let n = +foo;
n = 1 * foo;
const s = "" + foo;
const b = Boolean(foo);
const n = Number(foo);
const s = String(foo);