(line, regex, replacement)
| 28 | let mutated = false; |
| 29 | |
| 30 | const processLine = (line, regex, replacement) => { |
| 31 | const match = line.match(regex); |
| 32 | if (match) { |
| 33 | mutated = true; |
| 34 | |
| 35 | const identifiers = match[1].split(":"); |
| 36 | if (identifiers.includes(identifier)) { |
| 37 | line = line.replace(match[0], replacement); |
| 38 | } else { |
| 39 | // Remove matched text completely |
| 40 | line = line.replace(match[0], ""); |
| 41 | } |
| 42 | } else { |
| 43 | // No match: it's an ordinary line of code. |
| 44 | } |
| 45 | return line.trim() == "//" || line.trim() == "#" ? "" : line; |
| 46 | }; |
| 47 | |
| 48 | const countLeadingSpaces = (line) => { |
| 49 | const match = line.match(/^ */); |
no test coverage detected