* Remove all VT control characters. Use to estimate displayed string width. * @param {string} str * @returns {string}
(str)
| 3035 | * @returns {string} |
| 3036 | */ |
| 3037 | function 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 | |
| 3050 | module.exports = { |
| 3051 | identicalSequenceRange, |
no outgoing calls
no test coverage detected
searching dependent graphs…