in packages/dom/src/text-position/match.ts [57:71]
export function createTextPositionSelectorMatcher(
selector: TextPositionSelector,
): Matcher<Node | Range, Range> {
const abstractMatcher = abstractTextPositionSelectorMatcher(selector);
return async function* matchAll(scope) {
const textChunks = new TextNodeChunker(scope);
const matches = abstractMatcher(textChunks);
for await (const abstractMatch of matches) {
yield textChunks.chunkRangeToRange(abstractMatch);
}
};
}