strip-ansi是将转义码转换为原码

strip-ansi就是将转义后的符号复原

Install

1
npm install strip-ansi

Usage

1
2
3
4
const stripAnsi = require('strip-ansi');

stripAnsi('\u001B[4mUnicorn\u001B[0m');
//=> 'Unicorn'
  • strip-ansi-cli - CLI for this module
  • has-ansi - Check if a string has ANSI escape codes
  • ansi-regex - Regular expression for matching ANSI escape codes
  • chalk - Terminal string styling done right