(text: string, offsets: Array<[number, number]>, recordStart: number, recordEnd: number, urls: Array<readonly string[]>)
| 69 | } |
| 70 | |
| 71 | function processSiteFixesConfigBlock(text: string, offsets: Array<[number, number]>, recordStart: number, recordEnd: number, urls: Array<readonly string[]>) { |
| 72 | // TODO: more formal definition of URLs and delimiters |
| 73 | const block = text.substring(recordStart, recordEnd); |
| 74 | const lines = block.split('\n'); |
| 75 | const commandIndices: number[] = []; |
| 76 | lines.forEach((ln, i) => { |
| 77 | if (ln.match(/^[A-Z]+(\s[A-Z]+){0,2}$/)) { |
| 78 | commandIndices.push(i); |
| 79 | } |
| 80 | }); |
| 81 | |
| 82 | if (commandIndices.length === 0) { |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | offsets.push([recordStart, recordEnd - recordStart]); |
| 87 | |
| 88 | const urls_ = parseArray(lines.slice(0, commandIndices[0]).join('\n')); |
| 89 | urls.push(urls_); |
| 90 | } |
| 91 | |
| 92 | function extractURLsFromSiteFixesConfig(text: string): {urls: string[][]; offsets: Array<[number, number]>} { |
| 93 | const urls: string[][] = []; |
no test coverage detected