(oldId: string)
| 169 | const idMap = new Map<string, string>() |
| 170 | |
| 171 | const getOrCreateId = (oldId: string) => { |
| 172 | let newId = idMap.get(oldId) |
| 173 | if (!newId) { |
| 174 | newId = randomId() |
| 175 | idMap.set(oldId, newId) |
| 176 | } |
| 177 | return newId |
| 178 | } |
| 179 | |
| 180 | for (const node of data.nodes) { |
| 181 | node.id = getOrCreateId(node.id) |