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
{{ message }}
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
Currently it’s expected that the argument to Object.fromEntries be an iterable in the Symbol.iterator sense.
The Array.from and %TypedArray%.from methods permit array-like arguments; they fall back on looking for an appropriate length property and numeric keys. Because the ToLength operation coerces most values to 0, this means that they will also accept most objects:
My sense (which might be wrong) is that support for array-likes was a way to help bridge the gap with pre-ES2015 APIs. Should a new "from" method also support array-likes, or should it be limited to formal iterables like the Map and Set constructors?
Currently it’s expected that the argument to
Object.fromEntries
be an iterable in theSymbol.iterator
sense.The
Array.from
and%TypedArray%.from
methods permit array-like arguments; they fall back on looking for an appropriate length property and numeric keys. Because the ToLength operation coerces most values to 0, this means that they will also accept most objects:Array.from({})
// []Array.from({ length: 1 })
// [ undefined ]Array.from({ length: Infinity })
// RangeErrorMy sense (which might be wrong) is that support for array-likes was a way to help bridge the gap with pre-ES2015 APIs. Should a new "from" method also support array-likes, or should it be limited to formal iterables like the Map and Set constructors?
See #8 (comment)
The text was updated successfully, but these errors were encountered: