Reputation: 842
I am getting 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
error when using the following line of code
const errors = {};
for (const i of err.inner) {
errors[i.path] = i.message;
}
How can I restructure the code to remove this error Thanks
Upvotes: 2
Views: 1983
Reputation: 4050
Try this:
let errors = {};
err.inner.forEach(item => {
errors[item.path] = item.message;
});
Upvotes: 1