title: How do I persist a ES6 Map in localstorage (or elsewhere)?
body: <pre><code>var a = new Map([[ 'a', 1 ]]);
  a.get('a') // 1
  
  var forStorageSomewhere = JSON.stringify(a);
  // Store, in my case, in localStorage.
  
  // Later:
  var a = JSON.parse(forStorageSomewhere);
  a.get('a') // TypeError: undefined is not a function
  </code></pre>
  
  <p>Unfortunatly <code>JSON.stringify(a);</code> simply returns '{}', which means a becomes an empty object when restored.</p>
  
  <p>I found <a href="https://www.npmjs.com/package/es6-mapify" rel="noreferrer">es6-mapify</a> that allows up/down-casting between a Map and a plain object, so that might be one solution, but I was hoping I would need to resort to an external dependency simply to persist my map.</p>