This repository has no description
1export class Identifier<T> {
2 constructor(private value: T) {
3 this.value = value;
4 }
5
6 equals(id?: Identifier<T>): boolean {
7 if (id === null || id === undefined) {
8 return false;
9 }
10 if (!(id instanceof this.constructor)) {
11 return false;
12 }
13 return id.toValue() === this.value;
14 }
15
16 toString() {
17 return String(this.value);
18 }
19
20 /**
21 * Return raw value of identifier
22 */
23
24 toValue(): T {
25 return this.value;
26 }
27}