Comparing version 0.5.9 to 0.5.10
import { EventEmitter } from 'eventemitter3'; | ||
export declare class List<T> extends EventEmitter<'update'> implements Set<T>, RelativeIndexable<T> { | ||
readonly [Symbol.toStringTag] = "List"; | ||
constructor(values?: readonly T[] | Iterable<T> | null); | ||
protected data: Set<T>; | ||
@@ -18,2 +19,9 @@ array(): T[]; | ||
delete(value: T): boolean; | ||
union<U>(other: ReadonlySetLike<U>): List<T | U>; | ||
intersection<U>(other: ReadonlySetLike<U>): List<T & U>; | ||
difference<U>(other: ReadonlySetLike<U>): List<T>; | ||
symmetricDifference<U>(other: ReadonlySetLike<U>): List<T | U>; | ||
isSubsetOf(other: ReadonlySetLike<unknown>): boolean; | ||
isSupersetOf(other: ReadonlySetLike<unknown>): boolean; | ||
isDisjointFrom(other: ReadonlySetLike<unknown>): boolean; | ||
forEach(callbackfn: (value: T, value2: T, list: List<T>) => void, thisArg?: any): void; | ||
@@ -20,0 +28,0 @@ has(value: T): boolean; |
import { EventEmitter } from 'eventemitter3'; | ||
export class List extends EventEmitter { | ||
[Symbol.toStringTag] = 'List'; | ||
constructor(values) { | ||
super(); | ||
if (values) { | ||
this.push(...values); | ||
} | ||
} | ||
data = new Set(); | ||
@@ -77,2 +83,23 @@ array() { | ||
} | ||
union(other) { | ||
return new List(this.data.union(other)); | ||
} | ||
intersection(other) { | ||
return new List(this.data.intersection(other)); | ||
} | ||
difference(other) { | ||
return new List(this.data.difference(other)); | ||
} | ||
symmetricDifference(other) { | ||
return new List(this.data.symmetricDifference(other)); | ||
} | ||
isSubsetOf(other) { | ||
return this.data.isSubsetOf(other); | ||
} | ||
isSupersetOf(other) { | ||
return this.data.isSupersetOf(other); | ||
} | ||
isDisjointFrom(other) { | ||
return this.data.isDisjointFrom(other); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -79,0 +106,0 @@ forEach(callbackfn, thisArg) { |
{ | ||
"name": "utilium", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"description": "Typescript utilies", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -6,2 +6,9 @@ import { EventEmitter } from 'eventemitter3'; | ||
public constructor(values?: readonly T[] | Iterable<T> | null) { | ||
super(); | ||
if (values) { | ||
this.push(...values); | ||
} | ||
} | ||
protected data = new Set<T>(); | ||
@@ -100,2 +107,30 @@ | ||
public union<U>(other: ReadonlySetLike<U>): List<T | U> { | ||
return new List(this.data.union(other)); | ||
} | ||
public intersection<U>(other: ReadonlySetLike<U>): List<T & U> { | ||
return new List(this.data.intersection(other)); | ||
} | ||
public difference<U>(other: ReadonlySetLike<U>): List<T> { | ||
return new List(this.data.difference(other)); | ||
} | ||
public symmetricDifference<U>(other: ReadonlySetLike<U>): List<T | U> { | ||
return new List(this.data.symmetricDifference(other)); | ||
} | ||
public isSubsetOf(other: ReadonlySetLike<unknown>): boolean { | ||
return this.data.isSubsetOf(other); | ||
} | ||
public isSupersetOf(other: ReadonlySetLike<unknown>): boolean { | ||
return this.data.isSupersetOf(other); | ||
} | ||
public isDisjointFrom(other: ReadonlySetLike<unknown>): boolean { | ||
return this.data.isDisjointFrom(other); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
@@ -102,0 +137,0 @@ public forEach(callbackfn: (value: T, value2: T, list: List<T>) => void, thisArg?: any): void { |
{ | ||
"compilerOptions": { | ||
"lib": ["ES2023"], | ||
"lib": ["ESNext"], | ||
"module": "NodeNext", | ||
@@ -5,0 +5,0 @@ "target": "ES2023", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68230
1993