Last active
February 22, 2019 21:03
-
-
Save developit/d8d6bb56599f537aa6853fc91d9a0f70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof WeakMap !== 'function') { | |
let c = 0; | |
WeakMap = function() { | |
let id = typeof Symbol === 'function' ? Symbol() : `__weak$${++c}`; | |
this.set = (key, val) => { key[id] = val }; | |
this.get = key => key[id]; | |
}; | |
} |
Author
developit
commented
Feb 22, 2019
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment