feat: generate emojis pre

This commit is contained in:
YunYouJun
2022-04-16 09:07:53 +08:00
parent 4345ba6b6e
commit bff0d9eada
6 changed files with 33 additions and 25 deletions

15
src/utils/index.ts Normal file
View File

@@ -0,0 +1,15 @@
import { meat, staple, vegetable } from '~/data/food'
export function generateEmojisFromStuff(stuff: string[]) {
const emojis: string[] = []
stuff.forEach((item) => {
const kinds = [vegetable, meat, staple]
kinds.forEach((kind) => {
kind.forEach((m) => {
if (m.name === item)
emojis.push(m.emoji)
})
})
})
return emojis
}