Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (ESCAPES.indexOf(x) !== -1) {
insideEscape = true;
const code = /\d[^m]*/.exec(str.slice(i, str.indexOf('m', i)));
escapeCode = code === END_CODE ? null : code;
} else if (insideEscape && x === 'm') {
insideEscape = false;
leftEscape = true;
}
if (!insideEscape && !leftEscape) {
++visible;
}
if (
!astralRegex({ exact: true }).test(x) &&
isFullwidthCodePoint(x.codePointAt())
) {
++visible;
}
if (visible > begin && visible <= end) {
output += x;
} else if (
visible === begin &&
!insideEscape &&
escapeCode !== undefined &&
escapeCode !== END_CODE
) {
output += wrapAnsi(escapeCode);
} else if (visible >= end) {
if (escapeCode !== undefined) {