Skip to content

Latest commit

 

History

History
35 lines (20 loc) · 1016 Bytes

strip-ansi.md

File metadata and controls

35 lines (20 loc) · 1016 Bytes

strip-ansi

strip-ansi is a simple utility function that can be replaced with native APIs.

Alternatives

Node.js

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'

Documentation

Deno

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'

Documentation

Bun

Currently, Bun doesn't have a native API for stripVTControlCharacters yet.

Documentation