mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add TupleKey class
This commit is contained in:
19
src/types/TupleKey.ts
Normal file
19
src/types/TupleKey.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
const separator = "|";
|
||||||
|
|
||||||
|
export class TupleKey<T extends any[]> {
|
||||||
|
public readonly tuple: T;
|
||||||
|
private readonly strKey: string;
|
||||||
|
|
||||||
|
constructor(...tuple: T) {
|
||||||
|
this.tuple = tuple;
|
||||||
|
this.strKey = tuple.join(separator);
|
||||||
|
}
|
||||||
|
|
||||||
|
toString(): string {
|
||||||
|
return this.strKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
valueOf(): string {
|
||||||
|
return this.strKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user