Skip to content

Commit d39bf79

Browse files
committed
Update ObservableSet.ts
1 parent 3601a49 commit d39bf79

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

src/utils/ObservableSet.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,54 @@ export class ObservableSet<T> extends EventDispatcher<ObservableSetEventMap<T>>
172172

173173
}
174174

175+
union<U>(other: ReadonlySetLike<U>): Set<T | U> {
176+
177+
const result = new ObservableSet<T | U>();
178+
result.data = this.data.union(other);
179+
return result;
180+
181+
}
182+
183+
intersection<U>(other: ReadonlySetLike<U>): Set<T & U> {
184+
185+
const result = new ObservableSet<T & U>();
186+
result.data = this.data.intersection(other);
187+
return result;
188+
189+
}
190+
191+
difference<U>(other: ReadonlySetLike<U>): Set<T> {
192+
193+
const result = new ObservableSet<T>();
194+
result.data = this.data.difference(other);
195+
return result;
196+
197+
}
198+
199+
symmetricDifference<U>(other: ReadonlySetLike<U>): Set<T | U> {
200+
201+
const result = new ObservableSet<T | U>();
202+
result.data = this.data.symmetricDifference(other);
203+
return result;
204+
205+
}
206+
207+
isSubsetOf(other: ReadonlySetLike<unknown>): boolean {
208+
209+
return this.data.isSubsetOf(other);
210+
211+
}
212+
213+
isSupersetOf(other: ReadonlySetLike<unknown>): boolean {
214+
215+
return this.data.isSupersetOf(other);
216+
217+
}
218+
219+
isDisjointFrom(other: ReadonlySetLike<unknown>): boolean {
220+
221+
return this.data.isDisjointFrom(other);
222+
223+
}
224+
175225
}

0 commit comments

Comments
 (0)