( sourceHandle: string, oldBlockId: string, newBlockId: string )
| 39 | * @returns The remapped handle string, or the original if no remapping needed |
| 40 | */ |
| 41 | export function remapConditionEdgeHandle( |
| 42 | sourceHandle: string, |
| 43 | oldBlockId: string, |
| 44 | newBlockId: string |
| 45 | ): string { |
| 46 | for (const handlePrefix of HANDLE_PREFIXES) { |
| 47 | if (!sourceHandle.startsWith(handlePrefix)) continue |
| 48 | |
| 49 | const innerId = sourceHandle.slice(handlePrefix.length) |
| 50 | if (!innerId.startsWith(`${oldBlockId}-`)) continue |
| 51 | |
| 52 | const suffix = innerId.slice(oldBlockId.length + 1) |
| 53 | return `${handlePrefix}${newBlockId}-${suffix}` |
| 54 | } |
| 55 | |
| 56 | return sourceHandle |
| 57 | } |
no outgoing calls
no test coverage detected