ES6 draft rev23 updates
mathiasbynens opened this issue · comments
Array.from({ '0': 1, '2': 2, 'length': 3 })
should not return a sparse array
Discussed in http://esdiscuss.org/topic/array-from-and-sparse-arrays.
Array.from([1,,2])
returns a non-sparse array (because it uses the iterator case, see bug 2416), but Array.from({0: 1, 2: 2, length: 3 })
returns a sparse array (because it uses the ‘array-like’ case).
It was suggested that the two cases should be made consistent. Since “holes
are evil”, the array-like case should lose the kPresent
test in step 17b etc.
IsIterable
is not defined
It will be defined in the rev23. Once that happens, #4 can be fixed.
http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts#april_5_2014_draft_rev_23
7.4.2
IsIterable ( obj )
The abstract operation
IsIterable
with argumentobj
performs the following steps:
- If
Type(obj)
is notObject
, then returnundefined
.- Let
iteratorGetter
beGet(obj, @@Iterator)
.- Return
iteratorGetter
.
Line 59 in 1e9b05d
items
should be removed as per the latest http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from.This appears to have been cleared up - Array.from never leaves a hole. https://twitter.com/awbjs/status/496443722133798912