Safari has support for ES6 Maps and Sets in version 7.1 and higher (MDN).
I'm using a Map in my application and at some point want access to the values. Calling the values()
function on the map seems like the way to go and returns an Iterator. By calling next()
on the returned Iterator, one should be able to iterate over the values. This works fine in Chrome, but Safari does something strange. It returns a Map Iterator
when calling values()
, but the returned iterator has no next()
function.
m = new Map();
m.set(1, "test");
m.set("2", false);
it = m.values(); // returns Map Iterator
it.next(); // TypeError: undefined is not a function
Am I missing something obvious, or is the Safari implementation only partial?
Is there another way to get access to the values? Using the for..of
construct is not an option because this is new syntax and is not supported in older browsers (for which I use the es6-collections shim).