Skip to content

Commit

Permalink
refactor: kaomoji selection logic in bin.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Jan 7, 2024
1 parent e7ca7df commit 538cda7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bin.ts
Expand Up @@ -101,7 +101,10 @@ function logRoutes(data: Data) {

const kaomojis = ['♡⸜(˶˃ ᵕ ˂˶)⸝♡', '♡( ◡‿◡ )', '( ˶ˆ ᗜ ˆ˵ )', '(˶ᵔ ᵕ ᵔ˶)']

// Get system current language
function randomItem(items: string[]): string {
const index = Math.floor(Math.random() * items.length)
return items.at(index) ?? ''
}

app.listen(port, () => {
console.log(
Expand All @@ -110,7 +113,7 @@ app.listen(port, () => {
chalk.gray('Press CTRL-C to stop'),
chalk.gray(`Watching ${file}...`),
'',
chalk.magenta(kaomojis[Math.floor(Math.random() * kaomojis.length)]),
chalk.magenta(randomItem(kaomojis)),
'',
chalk.bold('Index:'),
chalk.gray(`http://localhost:${port}/`),
Expand Down

0 comments on commit 538cda7

Please sign in to comment.