(object: object)
| 24 | * @returns A uuidV4 string that uniquely identifies given object |
| 25 | */ |
| 26 | export function getObjectId(object: object): string { |
| 27 | const existing = OBJECTS_MAPPING.get(object); |
| 28 | if (existing !== undefined) { |
| 29 | return existing; |
| 30 | } |
| 31 | const id = randomUUID(); |
| 32 | OBJECTS_MAPPING.set(object, id); |
| 33 | return id; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Perform deep freeze of the given object (e. g. |