Polyfill for Maps and Sets
thaddee.tyl at gmail.com
Thu Jan 17 10:55:37 PST 2013
I believe it is impossible to do even a partially functional polyfill
for Maps and Sets in ES5.
Indeed, the only way to iterate through it is with the 'for (… of …)'
construct, which is sure to break in ES5.
I wish there was a way to polyfill it.
Something like 'Map.prototype.getKeys' could return an array of key
entries, for instance.
Obviously, Sets would benefit from the same treatment.
In the case of Sets especially, I can see this method as being
something that everybody would end up writing many times manually,
similar to how they now write the boilerplate to treat 'arguments'
like an Array, over and over again.
Could we consider something like that, please?
More information about the es-discuss