Disclaimer: Although I acknowledge the impact Coffeescript has had on the ES6 spec, I personally look forward to moving on from it.
The following Coffeescript loop (written by someone else)
if @props.total>1
for page in [<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d6e7f8f896a6a4b9a6a5f8a2b9a2b7ba">[email protected]</a>]
active = (page is <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e5cea595978a9596cb86909797808b91">[email protected]</a>)
translates to this JavaScript code according to js2coffee
var active, i, page, ref;
if (this.props.total > 1) {
for (page = i = 1, ref = this.props.total; 1 <= ref ? i <= ref : i >= ref; page = 1 <= ref ? ++i : --i) {
active = page === +this.props.current;
}
}
Now, I am interested in utilizing a for..of
loop to simplify that JavaScript code, but I'm struggling with how to approach it.
I attempted to apply this concept (specifically the generator function at the bottom), but haven't been successful.
So my query is: Is there a method for creating ranges in ES6?