Polyfill for Maps and Sets
brandon at brandonbenvie.com
Thu Jan 17 10:58:23 PST 2013
There's multiple polyfills for Map, Set, and WeakMap (WeakMap not being
fully implementable, but close). Here's one:
On Thu, Jan 17, 2013 at 1:55 PM, Thaddee Tyl <thaddee.tyl at gmail.com> wrote:
> 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?
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss