mori icon indicating copy to clipboard operation
mori copied to clipboard

ES6 iterator support

Open maxhoffmann opened this issue 9 years ago • 2 comments

In the readme it says:

All Mori collections support ES6 iteration via foo[Symbol.iterator] or foo["@@iterator"].

Array.from(mori.vector(1,2,3)) does not work though. Is there any documentation about this?

maxhoffmann avatar May 13 '15 22:05 maxhoffmann

maybe Array.from is Firefox only thing

it does work

var iterator = mori.vector(1,2,3)[Symbol.iterator]()
iterator.next()
// => { done: false, value: 1 }

jcouyang avatar May 15 '15 07:05 jcouyang

It doesn't work for me (mori v0.3.2, Chrome 43) --

var iterator = mori.vector(1,2,3)[Symbol.iterator]
// => undefined
var iterator = mori.vector(1,2,3)["@@iterator"]
// => undefined

ericgj avatar Jun 02 '15 18:06 ericgj