refactor: kaomoji selection logic in bin.ts

This commit is contained in:
typicode
2024-01-07 02:49:48 +01:00
parent e7ca7df492
commit 538cda754c

View File

@ -101,7 +101,10 @@ function logRoutes(data: Data) {
const kaomojis = ['♡⸜(˶˃ ᵕ ˂˶)⸝♡', '♡( ◡‿◡ )', '( ˶ˆ ᗜ ˆ˵ )', '(˶ᵔ ᵕ ᵔ˶)'] 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, () => { app.listen(port, () => {
console.log( console.log(
@ -110,7 +113,7 @@ app.listen(port, () => {
chalk.gray('Press CTRL-C to stop'), chalk.gray('Press CTRL-C to stop'),
chalk.gray(`Watching ${file}...`), chalk.gray(`Watching ${file}...`),
'', '',
chalk.magenta(kaomojis[Math.floor(Math.random() * kaomojis.length)]), chalk.magenta(randomItem(kaomojis)),
'', '',
chalk.bold('Index:'), chalk.bold('Index:'),
chalk.gray(`http://localhost:${port}/`), chalk.gray(`http://localhost:${port}/`),