(regex: RegExp, input: string, group = 0)
| 63 | } |
| 64 | |
| 65 | export 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 | |
| 74 | export function getStringSize(value: string): number { |
| 75 | return value.length * 2; |
no test coverage detected