Function: renameNode()
Call Signature
renameNode<
T>(root,currentId,nextId):T
Defined in: src/Mnemonic/structural-migrations.ts:164
Renames every node with the source id while preserving tree structure. Returns the original tree when the source id is missing or the target id already exists elsewhere.
Type Parameters
| Type Parameter | Description |
|---|---|
T extends StructuralNode<T> | Tree node type (must extend { id: string; children?: readonly T[] } when helpers is omitted) |
Parameters
| Parameter | Type | Description |
|---|---|---|
root | T | Root node to update |
currentId | string | Existing id to rename |
nextId | string | Replacement id |
Returns
T
Updated tree with matching node ids renamed
Call Signature
renameNode<
T>(root,currentId,nextId,helpers):T
Defined in: src/Mnemonic/structural-migrations.ts:177
Renames every node with the source id while preserving tree structure. Returns the original tree when the source id is missing or the target id already exists elsewhere.
Type Parameters
| Type Parameter | Description |
|---|---|
T | Tree node type |
Parameters
| Parameter | Type | Description |
|---|---|---|
root | T | Root node to update |
currentId | string | Existing id to rename |
nextId | string | Replacement id |
helpers | StructuralTreeHelpers<T> | Adapter for custom node shapes |
Returns
T
Updated tree with matching node ids renamed