Quantcast
Channel: How to properly extend ES6 Map - Stack Overflow
Browsing all 5 articles
Browse latest View live

Answer by quirimmo for How to properly extend ES6 Map

You can use your first approach using a class which extends Map.For example, the below is an implementation of queues (FIFO structures) extending Map, which allows you to manage queues in JavaScript...

View Article


Answer by Bergi for How to properly extend ES6 Map

It is unclear whether it's allowed by specificationIt is. Since ES6, all builtin types are extensible using class syntaxIt is unclear what browser/node.js versions support itThey need to support ES6...

View Article


Answer by Jonas Wilms for How to properly extend ES6 Map

The first one is the way to go. class syntax is supported with ES6, as well as Maps and extending Maps is part of this initial defininition too. So every system that supports Maps supports the first...

View Article

Answer by Guy Yogev for How to properly extend ES6 Map

What about overriding the methods?m = new Map()m.set('x', 2)m.get('x')=> 2Map.prototype.get = (x) => 'lalala'm.get('x')=> lalala

View Article

How to properly extend ES6 Map

I have a simple case: a ES6 Map, and I need to add custom get() and set() to it.But Map is a built-in object, so I'm not sure whether there would be any caveats in doing so. I've tried to search...

View Article

Browsing all 5 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>