Skip to content

Commit

Permalink
Improve code syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
matco committed Jul 16, 2024
1 parent 7b8149a commit 99504c7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ function provide_thing(search: string): Thing[] {
thing.score += 100;
}
}
thing.score > 0 ? matching_things.push(thing) : other_things.push(thing);
if(thing.score > 0) {
matching_things.push(thing);
}
else {
other_things.push(thing);
}
}
//continue searching if there is not enough options
if(matching_things.length < 5) {
Expand All @@ -45,7 +50,12 @@ function provide_thing(search: string): Thing[] {
thing.score += 10;
}
}
thing.score > 0 ? matching_things.push(thing) : other_things.push(thing);
if(thing.score > 0) {
matching_things.push(thing);
}
else {
other_things.push(thing);
}
}
//continue searching if here is not enough options and user's search is more than 3 characters
const word_inputs = inputs.filter(i => i.length > 3);
Expand Down Expand Up @@ -143,7 +153,7 @@ async function initialize() {
try {
await navigator.serviceWorker.register('/service-worker.js');
}
catch(_) {
catch {
console.error('Cache service worker registration failed');
}
}
Expand Down

0 comments on commit 99504c7

Please sign in to comment.