MCPcopy Index your code
hub / github.com/darkreader/darkreader / getMatchesWithOffsets

Function getMatchesWithOffsets

src/utils/text.ts:65–72  ·  view source on GitHub ↗
(regex: RegExp, input: string, group = 0)

Source from the content-addressed store, hash-verified

63}
64
65export function getMatchesWithOffsets(regex: RegExp, input: string, group = 0): Array<{text: string; offset: number}> {
66 const matches: Array<{text: string; offset: number}> = [];
67 let m: RegExpMatchArray | null;
68 while ((m = regex.exec(input))) {
69 matches.push({text: m[group], offset: m.index!});
70 }
71 return matches;
72}
73
74export function getStringSize(value: string): number {
75 return value.length * 2;

Callers 1

replaceCSSImportsFunction · 0.90

Calls 1

execMethod · 0.80

Tested by

no test coverage detected