Actually, Map is something I've missed several times lately when both Object and Array have fallen short. Set would also be useful. Having become used to the two in NodeJS, it's hard to live without them in Espruino :)
Arguments for adding Map:
With Map, keys can be of any type, they're easily iterated (in insertion order), and it's easy to get a map's size or check if it has a certain key. It performs better, and it just works! After years of trying to make Object behave like an associative array, it's like a breath of fresh air.
Shouldn't be too hard to implement, should it? :)
© Espruino, powered by microcosm.
Report a problem