diff options
author | Martin Fischer <martin@push-f.com> | 2025-04-02 21:18:41 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2025-04-03 08:01:25 +0200 |
commit | e318e64ab34d9da19829e8a097995081ab1bb486 (patch) | |
tree | 314212313d091a6272e06c90eb1db47b0570a1fc /script.js | |
parent | e403fb213a04306a706819b1a0a26cc2d8d66f41 (diff) |
chore: format script.js with Prettier
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 36 |
1 files changed, 16 insertions, 20 deletions
@@ -1,4 +1,4 @@ -(async function(){ +(async function () { const res = await fetch('data.json'); const versions = await res.json(); @@ -40,26 +40,24 @@ })(); function search(features, query) { - return Object.values(features).filter( - feat => { - if (feat.title.toLowerCase().replaceAll('`', '').includes(query)) { + return Object.values(features).filter((feat) => { + if (feat.title.toLowerCase().replaceAll('`', '').includes(query)) { + return true; + } + if (feat.flag && feat.flag.toLowerCase().includes(query)) { + return true; + } + if (query.length > 1) { + if (feat.aliases && feat.aliases.some((a) => a.toLowerCase().includes(query))) { return true; } - if (feat.flag && feat.flag.toLowerCase().includes(query)) { + if (feat.items && feat.items.some((i) => i.toLowerCase().includes(query))) { return true; } - if (query.length > 1) { - if (feat.aliases && feat.aliases.some(a => a.toLowerCase().includes(query))) { - return true; - } - if (feat.items && feat.items.some(i => i.toLowerCase().includes(query))) { - return true; - } - } - - return false; } - ); + + return false; + }); } function renderList(results) { @@ -69,10 +67,8 @@ function renderList(results) { const a = document.createElement('a'); a.textContent = feat.title; a.innerHTML = a.innerHTML.replaceAll(/`(.+?)`/g, (_, x) => `<code>${x}</code>`); - if (feat.url) - a.href = feat.url; - if (feat.flag) - a.title = feat.flag; + if (feat.url) a.href = feat.url; + if (feat.flag) a.title = feat.flag; li.appendChild(a); ul.appendChild(li); } |