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

Function stripVTControlCharacters

lib/internal/util/inspect.js:3037–3048  ·  view source on GitHub ↗

* Remove all VT control characters. Use to estimate displayed string width. * @param {string} str * @returns {string}

(str)

Source from the content-addressed store, hash-verified

3035 * @returns {string}
3036 */
3037function stripVTControlCharacters(str) {
3038 validateString(str, 'str');
3039
3040 // Short-circuit: all ANSI escape sequences start with either
3041 // ESC (\u001B, 7-bit) or CSI (\u009B, 8-bit) introducer.
3042 // If neither is present, the string has no VT control characters.
3043 if (StringPrototypeIndexOf(str, '\u001B') === -1 &&
3044 StringPrototypeIndexOf(str, '\u009B') === -1)
3045 return str;
3046
3047 return RegExpPrototypeSymbolReplace(ansi, str, '');
3048}
3049
3050module.exports = {
3051 identicalSequenceRange,

Callers 7

[kGetDisplayPos]Method · 0.85
inspect.jsFile · 0.85
mainFunction · 0.85
writeMethod · 0.85
#prettyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…