We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prefer-iterator-to-array
Iterator#toArray() is more clear to me that coverts iterator to array than [...iterator], especially when iterator is a long expression.
[...iterator]
iterator
// ❌ [...map.values()].map(value => value * 2) // ✅ map.values().toArray().map(value => value * 2) map.values().map(value => value * 2).toArray()
Full list of Iterators https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#description
Iterator
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Iterator#toArray() is more clear to me that coverts iterator to array than
[...iterator]
, especially wheniterator
is a long expression.Examples
Proposed rule name
prefer-iterator-to-array
Additional Info
Full list of
Iterator
s https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#descriptionThe text was updated successfully, but these errors were encountered: