| 818 | } |
| 819 | |
| 820 | const readsMatch = ( |
| 821 | written: WrittenUnit, |
| 822 | component: readonly BaseNode[], |
| 823 | s: ContentNamingState |
| 824 | ): boolean => { |
| 825 | if (written.component.length !== component.length) return false |
| 826 | for (let i = 0; i < component.length; i++) |
| 827 | if (written.component[i] !== component[i]) return false |
| 828 | for (const [id, name] of written.namesRead) |
| 829 | if (s.names[id] !== name) return false |
| 830 | for (const [id, node] of written.reachedRead) |
| 831 | if (s.byId[id]?.node !== node) return false |
| 832 | return true |
| 833 | } |
| 834 | |
| 835 | const writeComponent = ( |
| 836 | component: readonly BaseNode[], |