Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class GeneralSet {
map = new Map();
constructor(a = []) {
this[Symbol.iterator] = this.values;
if (a) a.forEach(_ => this.add(_));
}
add(el) {
this.map.set(el.toIdString(), el);
}
has(el) {
return this.map.has(el.toIdString());
}
values() {
return this.map.values();
}
delete(el) {
return this.map.delete(el.toIdString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment