diff --git a/index.js b/index.js index 45dd268..8d106fd 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -import stripAnsi from 'strip-ansi'; +import {stripVTControlCharacters} from 'node:util'; import {eastAsianWidth} from 'get-east-asian-width'; /** @@ -78,9 +78,9 @@ export default function stringWidth(input, options = {}) { let string = input; - // Avoid calling stripAnsi when there are no ANSI escape sequences (ESC = 0x1B, CSI = 0x9B) + // Avoid calling stripVTControlCharacters when there are no ANSI escape sequences (ESC = 0x1B, CSI = 0x9B) if (!countAnsiEscapeCodes && (string.includes('\u001B') || string.includes('\u009B'))) { - string = stripAnsi(string); + string = stripVTControlCharacters(string); } if (string.length === 0) { diff --git a/package.json b/package.json index 23f0d01..f9be9ed 100644 --- a/package.json +++ b/package.json @@ -54,8 +54,7 @@ "east-asian-width" ], "dependencies": { - "get-east-asian-width": "^1.5.0", - "strip-ansi": "^7.1.2" + "get-east-asian-width": "^1.5.0" }, "devDependencies": { "ava": "^6.4.1",