Function
getNodeAncestorPath
(
nodeTable: NodeTable,
nodeId?: string,
path: string[] = []
)
Source from the content-addressed store, hash-verified
| 518 | } |
| 519 | |
| 520 | function getNodeAncestorPath( |
| 521 | nodeTable: NodeTable, |
| 522 | nodeId?: string, |
| 523 | path: string[] = [] |
| 524 | ): string[] { |
| 525 | if (!nodeId) { |
| 526 | return path; |
| 527 | } |
| 528 | |
| 529 | const nodeRecord = nodeTable[nodeId]; |
| 530 | |
| 531 | if (!nodeRecord) { |
| 532 | return path; |
| 533 | } |
| 534 | |
| 535 | return getNodeAncestorPath( |
| 536 | nodeTable, |
| 537 | nodeRecord.parentId, |
| 538 | path.concat(nodeId) |
| 539 | ); |
| 540 | } |
| 541 | |
| 542 | type NodeRecord = { |
| 543 | id: string; |
Tested by
no test coverage detected