[CodeHealth] Replace ternary ops with logical expressions (#31558)

This PR is part of a couple of changes correcting these redundant
ternary operations:

```
x ? y : false -> x && y
x ? false : y -> !x && y
x ? y : true - > !x || y
x ? true : y -> x || y
```

This PR mirrors upstream work being done in the same direction:
https://issues.chromium.org/issues/416294715

Bug: https://github.com/brave/brave-browser/issues/49819
This commit is contained in:
cdesouza-chromium
2025-10-01 21:17:34 +01:00
committed by GitHub
parent dcca1c7dcd
commit daef249ec0
21 changed files with 43 additions and 52 deletions
@@ -120,7 +120,7 @@
// Check if we have a cookie.
if ( GACookie.length ) {
// If the cookie value is not empty we have a GA cookie.
hasGACookie = GACookie[0].trim().length > 4 ? true : false;
hasGACookie = GACookie[0].trim().length > 4;
}
// Id to use for localStorage object which holds the GA clientId and expire time.
@@ -553,7 +553,7 @@ window.idgus = window.idgus || {};
window.idgus.cmp = window.idgus.cmp || {};
(function (promise) {
promise.then(function (consentOk) {
var isDebug = !!window.idgus.cmp.isDebug ? window.idgus.cmp.isDebug() : false;
var isDebug = !!window.idgus.cmp.isDebug && window.idgus.cmp.isDebug();
if (isDebug) console.log('GDPR', 'blueconic - consentOk', consentOk);
if (!consentOk) return;
var bcscript = document.createElement("script");
@@ -7525,7 +7525,7 @@ _comscore.push(
return;
} else {
console.log("*****GDPR: sp_analytics.js: consent = " + consentOk);
var isDebug = !!window.idgus.cmp.isDebug ? window.idgus.cmp.isDebug() : false;
var isDebug = !!window.idgus.cmp.isDebug && window.idgus.cmp.isDebug();
if (isDebug) console.log('GDPR', 'sp_analytics - consentOk', consentOk);
if (!consentOk) return;
var spscript = document.createElement("script");