feat(ui): add Graph.getid() util

This commit is contained in:
psychedelicious 2024-06-24 19:58:32 +10:00
parent ebc498ad19
commit 7e0a6d1538

View File

@ -430,5 +430,16 @@ export class Graph {
assert(fromField !== undefined && toNodeId !== undefined && toField !== undefined, 'Invalid edge arguments');
return `${fromNodeId}.${fromField} -> ${toNodeId}.${toField}`;
}
/**
* Gets a unique id.
* @param prefix An optional prefix
*/
static getId(prefix?: string): string {
if (prefix) {
return `${prefix}_${uuidv4()}`;
} else {
return uuidv4();
}
}
//#endregion
}