test
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
mol
2023-12-14 14:35:47 +08:00
parent 579d39fa4a
commit 16196c46ac
3 changed files with 106 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import pkg from 'node-csv';
import logger from '#root/utils/logger.js';
import { emojiMap } from './food.js'
import path from 'path';
const __dirname = path.dirname(new URL(import.meta.url).pathname);
@ -17,11 +18,19 @@ function parser() {
}
logger('食谱加载成功');
const keys = data.shift()
keys[0] = keys[0].slice(1)
recipeData = data.map(d => {
const res = {}
keys.forEach((key, index) => {
if (key) {
res[key] = d[index]
let text = d[index]
if (key === 'stuff') {
text = text.split('、').map(t => {
return `${emojiMap.has(t) ? emojiMap.get(t) + ' ' : ''}${t}`
}).join('、')
}
res[key] = text
}
})
return res
@ -42,5 +51,5 @@ export default async function getDb() {
}
// getDb().then((res) => {
// console.log(recipeData)
// // console.log(recipeData)
// })