strip-ansi
is a simple utility function that can be replaced with native APIs.
Added in v16.11.0, util.stripVTControlCharacters
can be used to strip ANSI escape codes from a string.
import { stripVTControlCharacters } from 'node:util';
console.log(stripVTControlCharacters('\u001B[4me18e\u001B[0m')); // returns 'e18e'
Added as a part of Node API, util.stripVTControlCharacters
can be used to strip ANSI escape codes from a string.
import { stripVTControlCharacters } from 'node:util';
console.log(stripVTControlCharacters('\u001B[4me18e\u001B[0m')); // returns 'e18e'
Currently, Bun doesn't have a native API for stripVTControlCharacters
yet.