I use the following code that works as expected, while using a ESLINT i got error
ESLint: 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)
This is the code
for (const subscription of resp.data.subscriptions) {
if (subscription.url) {
return subscription.url;
}
}
The code is simply
- get an array of data from other function
- loop on each array item
- when the first array instance have url take it and return
Is there a way to write it better to avoid the eslint issue ?