mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-01 05:09:34 +02:00
feat(utils): create a standard edge id function
This commit is contained in:
@@ -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}` : ''}`;
|
||||
};
|
||||
|
Reference in New Issue
Block a user