Closed ljharb closed 6 years ago
applying array methods to
arguments
via.call
is a common pattern
I think that will still work with no changes, right? The difference would only arise if you had arguments
inside of another array (or arguments object) which you're calling .flatten
or .flatMap
on.
ahhh yes you're right, this issue would only be about if i had [arguments].flatten()
; Array.prototype.flatten.call(arguments)
would work fine.
Thanks for clarifying :-)
Typically, Array methods are liberal in what they accept, although they always return arrays.
These methods clearly can't take concat-spreadables because NodeLists, and can't take arraylikes because Strings, however, applying array methods to
arguments
via.call
is a common pattern.If https://github.com/tc39/proposal-flatMap/blob/master/proposal.html#L55 changed to "If spreadable is true or element is an arguments exotic object", then it should work.
(linking to #37 as well)