From 7de1fd757e164d5f291d2572778a2bfdda190195 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Wed, 29 Jan 2025 16:57:00 -0800 Subject: [PATCH] add TupleKey class --- src/types/TupleKey.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/types/TupleKey.ts diff --git a/src/types/TupleKey.ts b/src/types/TupleKey.ts new file mode 100644 index 0000000..08dcfb4 --- /dev/null +++ b/src/types/TupleKey.ts @@ -0,0 +1,19 @@ +const separator = "|"; + +export class TupleKey { + 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; + } +}