I have the Code for some iterations and it works well. After installing eslint, One of my code generates an error by eslint.
My code is:
for (const column of columns) {
for (const slugname of result[column.name]) {
const alphabet = slugname.slugname;
if (total[alphabet]) {
total[alphabet] += column.value;
} else {
total[alphabet] = column.value;
}
}
}
eslint generates an error which is this
error 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 no-restricted-syntax
Any help or suggestion is really appreciated for that. According to me The code was written very precisely and very small, don't know about the clue of eslint error
There is nothing wrong with your code, this is outdated guidance.
columns.map(x => result[x.name].map((y) => {
const alphabet = y.slugname;
if (total[alphabet]) {
total[alphabet] += x.value;
} else {
total[alphabet] = x.value;
}
return true;
}));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With