Skip to content

Instantly share code, notes, and snippets.

@vkurchatkin
Created September 14, 2016 13:15
Show Gist options
  • Save vkurchatkin/9769f70b35181e8244b7a9e480b9bc6b to your computer and use it in GitHub Desktop.
Save vkurchatkin/9769f70b35181e8244b7a9e480b9bc6b to your computer and use it in GitHub Desktop.
class WeakMap {
constructor() {
this.s = Symbol();
}
set(key, val) {
key[this.s] = val;
}
get(key) {
return key[this.s];
}
has(key) {
return key.hasOwnProperty(this.s);
}
delete(key) {
delete key[this.s];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment