Skip to content

Commit

Permalink
Set.difference is not actually used
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbmatter committed Jan 31, 2025
1 parent 3cf4525 commit 433f301
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/common/polyfills-modern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,6 @@ type SetReadOperations<T> = {
has(key: T): boolean;
keys(): IterableIterator<T>;
};
if (!Set.prototype.difference) {
Object.defineProperty(Set.prototype, "difference", {
value<T>(this: Set<T>, other: SetReadOperations<T>): Set<T> {
const result = new Set<T>(this);
if (this.size <= other.size) {
for (const elem of this) {
if (other.has(elem)) {
result.delete(elem);
}
}
} else {
for (const elem of other.keys()) {
if (result.has(elem)) {
result.delete(elem);
}
}
}
return result;
},
writable: true,
enumerable: false,
configurable: true,
});
}
if (!Set.prototype.isSubsetOf) {
Object.defineProperty(Set.prototype, "isSubsetOf", {
value<T>(this: Set<T>, other: SetReadOperations<T>): boolean {
Expand Down

0 comments on commit 433f301

Please sign in to comment.