blob: 1b4eb193d30771374e0f97faa8fbc0ef126982d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
declare global {
interface Set<T> {
/** @summary check if any of the elements of `arr2` are included in `this` */
anyOf(arr2: Array<T>): boolean;
/** @summary return set items as array */
arr(): Array<T>;
}
}
Set.prototype.arr = function() {
return Array.from(this);
}
Set.prototype.anyOf = function(arr2) {
return !!this.arr().filter(e => arr2.includes(e)).length;
};
|