(content: string, key: string)
| 170 | return pairs; |
| 171 | } |
| 172 | export function findArrayIndicesTsManifest(content: string, key: string): [number, number] { |
| 173 | const start = content.indexOf(`${key}:`); |
| 174 | if (start === -1) throw new Error(`${key} not found`); |
| 175 | const pairs = findMatchingIndices(content, '[', ']', start); |
| 176 | |
| 177 | if (pairs.length === 0) throw new Error(`${key} contains unbalanced brackets`); |
| 178 | |
| 179 | return pairs[0]; |
| 180 | } |
| 181 | export function replaceArrayValueInTsManifest(content: string, key: string, newValue: string): string { |
| 182 | const [startIndex, endIndex] = findArrayIndicesTsManifest(content, key); |
| 183 | return content.slice(0, startIndex) + newValue + content.slice(endIndex + 1); |
no test coverage detected