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
Running into some issues regarding your use of the for...in statement for array iteration. for...in is for enumerable properties of collections, not iteration through iterables (e.g. Arrays). I'd recommend using array.forEach(), for...of (broadly supported by Node >= 0.12, dunno about browser compat.) or a standard for loop, which is obviously more verbose but more appropriate than for...in.
for...in will throw when some dingus (not me, but there are lots of dinguses out there) modifies the Array prototype, because for...in will kick back any additional enumerable properties, not just the elements of the array.
Copy-pasta'd some relevant code from the MDN demonstrating the issue.
Howdy, love the library.
Running into some issues regarding your use of the
for...in
statement for array iteration.for...in
is for enumerable properties of collections, not iteration through iterables (e.g. Arrays). I'd recommend usingarray.forEach()
,for...of
(broadly supported by Node >= 0.12, dunno about browser compat.) or a standardfor
loop, which is obviously more verbose but more appropriate thanfor...in
.for...in
will throw when some dingus (not me, but there are lots of dinguses out there) modifies the Array prototype, becausefor...in
will kick back any additional enumerable properties, not just the elements of the array.Copy-pasta'd some relevant code from the MDN demonstrating the issue.
Add
Array.prototype.foo = () => 'bar'
to index.js and run the test suite. It'll run through all the places where that needs to be changed.Cheers!
The text was updated successfully, but these errors were encountered: