Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including safari-fix-map with all npm packages installed. Try it out:

var safariFixMap = require("safari-fix-map")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

safari-fix-map v1.1.0

Simple commonjs module to replace Safari's bugginess with better polyfills.


This is a short javascript module that checks whether it is running on Safari, and if so, deletes window.Map and replaces it with a more competent polyfill.

Safari's Map implementation has bugs that causes it to sometimes return completely wrong objects from its .get method. It might have to do with using Maps in browser extensions or MutationObserver callbacks. I suspect those aren't well-tested in Safari. I have stared at error stacks and prodded debuggers to check my sanity. I have looked into the abyss. I have seen this code fail in Safari 8:

function checkMap(map) {
  map.forEach(function(value, key) {
    if (!Number.isNaN(value) && value !== map.get(key)) {
      throw new Error("world is insane at key "+key);

This module is for people who wish to seal Eldritch horrors securely away.

Recommended Usage

You're using Browserify and NPM, right?

npm i --save safari-fix-map
// Go on with your life in freedom


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free