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

Function markSourceColumn

lib/internal/debugger/inspect_repl.js:154–168  ·  view source on GitHub ↗
(sourceText, position, useColors)

Source from the content-addressed store, hash-verified

152}
153
154function markSourceColumn(sourceText, position, useColors) {
155 if (!sourceText) return '';
156
157 const head = StringPrototypeSlice(sourceText, 0, position);
158 let tail = StringPrototypeSlice(sourceText, position);
159
160 // Colourize char if stdout supports colours
161 if (useColors) {
162 tail = SideEffectFreeRegExpPrototypeSymbolReplace(/(.+?)([^\w]|$)/, tail,
163 '\u001b[32m$1\u001b[39m$2');
164 }
165
166 // Return source line with coloured char at `position`
167 return head + tail;
168}
169
170function extractErrorMessage(stack) {
171 if (!stack) return '<unknown>';

Callers 1

[customInspectSymbol]Method · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…