diff options
-rw-r--r-- | .prettierrc.toml | 4 | ||||
-rw-r--r-- | script.js | 36 |
2 files changed, 20 insertions, 20 deletions
diff --git a/.prettierrc.toml b/.prettierrc.toml new file mode 100644 index 0000000..96c2143 --- /dev/null +++ b/.prettierrc.toml @@ -0,0 +1,4 @@ +singleQuote = true +tabWidth = 2 +useTabs = true +printWidth = 100 @@ -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); } |