@Gordon If considered then I think it would require native support to match the spec behavior
Proper Map and Set implementation allow the keys be an arbitrary Object for polyfills that requires the lookup be O(n) instead of O(1) as there AFAIK isn't any other way then to approximately this m.get = (key) => m[ Object.keys(m).find(k => m[k] === key) ].
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Gordon If considered then I think it would require native support to match the spec behavior
Proper
Map
andSet
implementation allow the keys be an arbitrary Object for polyfills that requires the lookup beO(n)
instead ofO(1)
as there AFAIK isn't any other way then to approximately thism.get = (key) => m[ Object.keys(m).find(k => m[k] === key) ]
.