I have run into many situations where what I need is a Map. When I do I always have the same question that needs to be answered: Should I polyfill Map or attempt to use a POJO as a Map? Ember has a private implementation of Map which would be nice but it is private.
For production code I’m looking for
- maintainability (will this be supported as the app upgrades)
- readability (how easy is it to grok its usage)
- developer ergonomics (how easy is it to work with)
Object.keys then it is to simply iterate over the Map (
for (let [ key, value ] of myMap)) and less performent to force iteration to get a single value with two-dimentional arrays.
My questions are:
- Is it worth forcing a babel polyfill for the use of the built in Map?
- Is the private ember Map worth looking into if the keys are not strings?
- If the keys are always strings is it worth using Map at all just for the iteration and nice API or just manipulate a POJO with
delete pojo[name], and