refactor: migrate to nuxt

This commit is contained in:
YunYouJun
2023-07-30 03:08:42 +08:00
parent c23f39e8c0
commit 0dfec1831b
90 changed files with 7864 additions and 3962 deletions

17
utils/index.ts Normal file
View File

@@ -0,0 +1,17 @@
import { meat, staple, vegetable } from '~/data/food'
const foodItems = [...vegetable, ...meat, ...staple]
const foodEmojiMap = new Map()
foodItems.forEach((item) => {
foodEmojiMap.set(item.name, item.emoji)
})
/**
* get emojis from stuff name array
* @param stuff
* @returns
*/
export function getEmojisFromStuff(stuff: string[]) {
const emojis: string[] = stuff.map(name => foodEmojiMap.get(name)).filter(item => !!item)
return emojis
}