From 406e7f09925dffcd87380e613cfb33a540c5c4e5 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Wed, 8 Jul 2026 11:16:06 +0200 Subject: [PATCH] Apply Copilot's suggestions II Signed-off-by: yubiuser --- scripts/js/gravity.js | 2 +- scripts/js/interfaces.js | 4 ++-- scripts/js/queries.js | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/js/gravity.js b/scripts/js/gravity.js index df971b4c..bcf03800 100644 --- a/scripts/js/gravity.js +++ b/scripts/js/gravity.js @@ -130,7 +130,7 @@ function parseLines(outputElement, text) { return closingTags; } - if (ansiMappings[match] === true) { + if (Object.hasOwn(ansiMappings, match)) { // Opening span spanCount++; return ``; diff --git a/scripts/js/interfaces.js b/scripts/js/interfaces.js index 8a918717..a1b69013 100644 --- a/scripts/js/interfaces.js +++ b/scripts/js/interfaces.js @@ -121,7 +121,7 @@ function findMasterInterface({ iface, masterInterfaces, interfacesData }) { } const masterName = masterObj.name; - if (masterInterfaces[masterName] === true) { + if (Array.isArray(masterInterfaces[masterName])) { masterInterfaces[masterName].push(iface.name); } else { masterInterfaces[masterName] = [iface.name]; @@ -485,7 +485,7 @@ function sortInterfaces(interfaces, masterInterfaces) { // Add slave interfaces next to master interfaces for (const master of interfaceList) { - if (masterInterfaces[master] === true) { + if (Array.isArray(masterInterfaces[master])) { for (const slave of masterInterfaces[master]) { ifaces.splice(ifaces.indexOf(slave), 1); interfaceList.splice(interfaceList.indexOf(master) + 1, 0, slave); diff --git a/scripts/js/queries.js b/scripts/js/queries.js index 3779eee3..a0ad608f 100644 --- a/scripts/js/queries.js +++ b/scripts/js/queries.js @@ -510,8 +510,12 @@ function parseFilters() { } function filterOn(param, dict) { + if (!Object.hasOwn(dict, param)) { + return false; + } + const typ = typeof dict[param]; - return dict[param] && (typ === "number" || (typ === "string" && dict[param].length > 0)); + return typ === "number" || (typ === "string" && dict[param].length > 0); } function getAPIURL(queryFilters) {