(src: string, tag: string)
| 115 | * @param src |
| 116 | */ |
| 117 | export function removeGeneratedContents(src: string, tag: string): string | null { |
| 118 | const { contents, start, end } = getGeneratedSectionIndexes(src, tag); |
| 119 | if (start > -1 && end > -1 && start < end) { |
| 120 | contents.splice(start, end - start + 1); |
| 121 | // TODO: We could in theory check that the contents we're removing match the hash used in the header, |
| 122 | // this would ensure that we don't accidentally remove lines that someone added or removed from the generated section. |
| 123 | return contents.join('\n'); |
| 124 | } |
| 125 | return null; |
| 126 | } |
| 127 | |
| 128 | export function createGeneratedHeaderComment( |
| 129 | contents: string, |
no test coverage detected