(source: string)
| 247 | } |
| 248 | |
| 249 | function collectStringConstants(source: string): Map<string, string> { |
| 250 | const constants = new Map<string, string>(); |
| 251 | const regex = /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(["'`])/g; |
| 252 | let match: RegExpExecArray | null; |
| 253 | |
| 254 | while ((match = regex.exec(source)) !== null) { |
| 255 | const literal = readStringLiteral(source, regex.lastIndex - 1); |
| 256 | if (!literal) continue; |
| 257 | constants.set(match[1], literal.value); |
| 258 | regex.lastIndex = literal.end; |
| 259 | } |
| 260 | |
| 261 | return constants; |
| 262 | } |
| 263 | |
| 264 | function findOptionsObjectSpans(source: string): Array<{ start: number; end: number }> { |
| 265 | const spans: Array<{ start: number; end: number }> = []; |
no test coverage detected