export type StrandPath = { tokenIndex: number; childIndex: number }[]; export type TokenPath = { strandPath: StrandPath; tokenIndex: number; }; export function strandPathsEqual(a: StrandPath, b: StrandPath): boolean { if (a.length !== b.length) return false; for (let i = 0; i < a.length; i++) { if (a[i].tokenIndex !== b[i].tokenIndex) return false; if (a[i].childIndex !== b[i].childIndex) return false; } return true; } export function strandPathIsAncestor( parent: StrandPath, child: StrandPath ): boolean { if (parent.length >= child.length) return false; for (let i = 0; i < parent.length; i++) { if (parent[i].tokenIndex !== child[i].tokenIndex) return false; if (parent[i].childIndex !== child[i].childIndex) return false; } return true; }