mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-19 21:04:33 +08:00
9 lines
222 B
TypeScript
9 lines
222 B
TypeScript
export const parseUniqueKey = (
|
|
key: string,
|
|
existingKeys: string[],
|
|
count = 0
|
|
): string => {
|
|
if (!existingKeys.includes(key)) return key
|
|
return parseUniqueKey(`${key} (${count + 1})`, existingKeys, count + 1)
|
|
}
|