Comparing version 0.6.3 to 0.7.0
import { EventEmitter } from 'eventemitter3'; | ||
export declare class List<T> extends EventEmitter<'update'> implements Set<T>, RelativeIndexable<T> { | ||
export declare class List<T> extends EventEmitter<'update'> implements RelativeIndexable<T> { | ||
readonly [Symbol.toStringTag] = "List"; | ||
constructor(values?: readonly T[] | Iterable<T> | null); | ||
protected data: Set<T>; | ||
array(): T[]; | ||
json(): string; | ||
toSet(): Set<T>; | ||
toArray(): T[]; | ||
toJSON(): string; | ||
toString(): string; | ||
@@ -19,10 +20,2 @@ set(index: number, value: T): void; | ||
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; | ||
has(value: T): boolean; | ||
@@ -29,0 +22,0 @@ get size(): number; |
@@ -11,6 +11,9 @@ import { EventEmitter } from 'eventemitter3'; | ||
data = new Set(); | ||
array() { | ||
toSet() { | ||
return new Set(this.data); | ||
} | ||
toArray() { | ||
return [...this.data]; | ||
} | ||
json() { | ||
toJSON() { | ||
return JSON.stringify([...this.data]); | ||
@@ -84,27 +87,2 @@ } | ||
} | ||
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 | ||
forEach(callbackfn, thisArg) { | ||
this.data.forEach((v1, v2) => callbackfn.call(thisArg, v1, v2, this)); | ||
} | ||
has(value) { | ||
@@ -111,0 +89,0 @@ return this.data.has(value); |
{ | ||
"name": "utilium", | ||
"version": "0.6.3", | ||
"version": "0.7.0", | ||
"description": "Typescript utilies", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import { EventEmitter } from 'eventemitter3'; | ||
export class List<T> extends EventEmitter<'update'> implements Set<T>, RelativeIndexable<T> { | ||
export class List<T> extends EventEmitter<'update'> implements RelativeIndexable<T> { | ||
public readonly [Symbol.toStringTag] = 'List'; | ||
@@ -15,7 +15,11 @@ | ||
public array(): T[] { | ||
public toSet(): Set<T> { | ||
return new Set(this.data); | ||
} | ||
public toArray(): T[] { | ||
return [...this.data]; | ||
} | ||
public json() { | ||
public toJSON() { | ||
return JSON.stringify([...this.data]); | ||
@@ -107,35 +111,2 @@ } | ||
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 | ||
public forEach(callbackfn: (value: T, value2: T, list: List<T>) => void, thisArg?: any): void { | ||
this.data.forEach((v1, v2) => callbackfn.call(thisArg, v1, v2, this)); | ||
} | ||
public has(value: T): boolean { | ||
@@ -142,0 +113,0 @@ return this.data.has(value); |
68367
1995