You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've seen a bunch of examples where Array(n).keys() is used as part of a list comprehension. Since keys() here returns an iterator the typical form is like Array.from(Array(n).keys()) or [...Array(n).keys()]
This has the overhead of extra intermediate array(s) and using the callback for Array.from() although more verbose is the best performer.
Description
I've seen a bunch of examples where
Array(n).keys()
is used as part of a list comprehension. Sincekeys()
here returns an iterator the typical form is likeArray.from(Array(n).keys())
or[...Array(n).keys()]
This has the overhead of extra intermediate array(s) and using the callback for
Array.from()
although more verbose is the best performer.See examples for details.
Examples
Proposed rule name
prefer-callback-for-list-comprehension
Additional Info
No response
The text was updated successfully, but these errors were encountered: