Trying to get away with custom get/set functionality on ES6 Maps. Currently using Babel to transpile my code to ES5.
Chrome Version 41.0.2272.101 m
Babel explictly states they do not support extending built-in classes. See http://babeljs.io/docs/usage/caveats/#classes. The reasons are not quite as simple as "limitations in ES5", however, since Map
is not an ES5 feature to begin with. It appears that implementations of Map do not support basic patterns such as
Map.prototype.set.call(mymap, 'key', 1);
which is essentially what Babel generates in this case. The problem is that implementations of Map including V8 are overly restrictive and check that the this
in the Map.set.call
call is precisely a Map, rather than having Map in its prototype chain.
Same applies to Promise.