How do I persist a ES6 Map in localstorage (or elsewhere)?
Clean as a whistle:
JSON.stringify([...myMap])
Assuming that both your keys and your values are serialisable,
localStorage.myMap = JSON.stringify(Array.from(map.entries()));
should work. For the reverse, use
map = new Map(JSON.parse(localStorage.myMap));