diff --git a/packages/mermaid/src/utils.ts b/packages/mermaid/src/utils.ts index 06aca5ab2..99283f359 100644 --- a/packages/mermaid/src/utils.ts +++ b/packages/mermaid/src/utils.ts @@ -929,3 +929,19 @@ export const decodeEntities = function (text: string): string { export const isString = (value: unknown): value is string => { return typeof value === 'string'; }; + +export const getEdgeId = ( + from: string, + to: string, + { + counter = 0, + prefix, + suffix, + }: { + counter?: number; + prefix?: string; + suffix?: string; + } +) => { + return `${prefix ? `${prefix}_` : ''}${from}_${to}_${counter}${suffix ? `_${suffix}` : ''}`; +};