* Get the line of source in the source map. * @param {import('internal/source_map/source_map').SourceMap} sourceMap * @param {string} originalSourcePath path or url of the original source * @param {number} originalLine line number in the original source * @returns {string|undefined} source line
( sourceMap, originalSourcePath, originalLine, )
| 443 | * @returns {string|undefined} source line if found |
| 444 | */ |
| 445 | function getSourceLine( |
| 446 | sourceMap, |
| 447 | originalSourcePath, |
| 448 | originalLine, |
| 449 | ) { |
| 450 | const source = getOriginalSource( |
| 451 | sourceMap.payload, |
| 452 | originalSourcePath, |
| 453 | ); |
| 454 | if (typeof source !== 'string') { |
| 455 | return; |
| 456 | } |
| 457 | const lines = RegExpPrototypeSymbolSplit(/\r?\n/, source, originalLine + 1); |
| 458 | const line = lines[originalLine]; |
| 459 | return line; |
| 460 | } |
| 461 | |
| 462 | module.exports = { |
| 463 | findSourceMap, |
no test coverage detected
searching dependent graphs…