mori icon indicating copy to clipboard operation
mori copied to clipboard

ES2015 iterator support not really provided

Open ralf-o opened this issue 10 years ago • 3 comments
trafficstars

The following sentence from the mori website is currently not really true: "All Mori collections support ES6 iteration via foo[Symbol.iterator] or foo['@@iterator']"

mori.list(1, 2, 3)['@@iterator'] returns undefined.

See also: http://jsfiddle.net/4utqrsta

ralf-o avatar Sep 01 '15 08:09 ralf-o

JSFiddle is ES5, so of course it doesn't work there. You would need to bring in something like Babel to start seeing those features work. That said, you're still correct that it's undefined even in an ES6 context.

neverfox avatar Oct 18 '15 18:10 neverfox

After fixing it to Symbol.iterator instead of '@@iterator', I can still confirm.

dead-claudia avatar May 29 '16 16:05 dead-claudia

looks like closure compiler is messing with that. in 0.3.2 I found setting

list[Symbol.iterator] = list.prototype['undefined']

clears seem to work

wishfoundry avatar Mar 23 '17 00:03 wishfoundry