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

Method findEntry

lib/internal/source_map/source_map.js:196–226  ·  view source on GitHub ↗

* @param {number} lineOffset 0-indexed line offset in compiled resource * @param {number} columnOffset 0-indexed column offset in compiled resource * @returns {object} representing start of range if found, or empty object

(lineOffset, columnOffset)

Source from the content-addressed store, hash-verified

194 * @returns {object} representing start of range if found, or empty object
195 */
196 findEntry(lineOffset, columnOffset) {
197 let first = 0;
198 let count = this.#mappings.length;
199 while (count > 1) {
200 const step = count >> 1;
201 const middle = first + step;
202 const mapping = this.#mappings[middle];
203 if (lineOffset < mapping[0] ||
204 (lineOffset === mapping[0] && columnOffset < mapping[1])) {
205 count = step;
206 } else {
207 first = middle;
208 count -= step;
209 }
210 }
211 const entry = this.#mappings[first];
212 if (!first && entry && (lineOffset < entry[0] ||
213 (lineOffset === entry[0] && columnOffset < entry[1]))) {
214 return {};
215 } else if (!entry) {
216 return {};
217 }
218 return {
219 generatedLine: entry[0],
220 generatedColumn: entry[1],
221 originalSource: entry[2],
222 originalLine: entry[3],
223 originalColumn: entry[4],
224 name: entry[5],
225 };
226 }
227
228 /**
229 * @param {number} lineNumber 1-indexed line number in compiled resource call site

Callers 9

findOriginMethod · 0.95
reconstructCallSiteFunction · 0.45
constructorMethod · 0.45
serializeJSStackFrameFunction · 0.45
getOriginalSymbolNameFunction · 0.45
getSourceMapErrorSourceFunction · 0.45
getErrorSourceLocationFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected