MCPcopy Index your code
hub / github.com/nodejs/node / getSourceLine

Function getSourceLine

lib/internal/source_map/source_map_cache.js:445–460  ·  view source on GitHub ↗

* 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,
)

Source from the content-addressed store, hash-verified

443 * @returns {string|undefined} source line if found
444 */
445function 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
462module.exports = {
463 findSourceMap,

Callers 2

getErrorSourceFunction · 0.85
getErrorSourceLocationFunction · 0.85

Calls 1

getOriginalSourceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…