使用以下代码行时出现iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations
错误
const errors = {};
for (const i of err.inner) {
errors[i.path] = i.message;
}
如何重组代码以消除此错误 谢谢
答案 0 :(得分:1)
尝试一下:
let errors = {};
err.inner.forEach(item => {
errors[item.path] = item.message;
});