File tree Expand file tree Collapse file tree 5 files changed +17
-6
lines changed
Expand file tree Collapse file tree 5 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 11/**
2- Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).
2+ Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
3+
4+ @example
5+ ```
6+ import stripAnsi from 'strip-ansi';
7+
8+ stripAnsi('\u001B[4mUnicorn\u001B[0m');
9+ //=> 'Unicorn'
10+
11+ stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
12+ //=> 'Click'
13+ ```
314*/
4- export default function stripAnsi ( str : string ) : string ;
15+ export default function stripAnsi ( string : string ) : string ;
Original file line number Diff line number Diff line change 11'use strict' ;
22const ansiRegex = require ( 'ansi-regex' ) ;
33
4- const stripAnsi = input => typeof input === 'string' ? input . replace ( ansiRegex ( ) , '' ) : input ;
4+ const stripAnsi = string => typeof string === 'string' ? string . replace ( ansiRegex ( ) , '' ) : string ;
55
66module . exports = stripAnsi ;
77module . exports . default = stripAnsi ;
Original file line number Diff line number Diff line change 11import { expectType } from 'tsd-check' ;
22import stripAnsi from '.' ;
33
4- expectType < string > ( stripAnsi ( '\u001b [4mcake\u001b [0m' ) ) ;
4+ expectType < string > ( stripAnsi ( '\u001B [4mcake\u001B [0m' ) ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " strip-ansi" ,
33 "version" : " 5.1.0" ,
4- "description" : " Strip ANSI escape codes" ,
4+ "description" : " Strip ANSI escape codes from a string " ,
55 "license" : " MIT" ,
66 "repository" : " chalk/strip-ansi" ,
77 "author" : {
Original file line number Diff line number Diff line change 11# strip-ansi [ ![ Build Status] ( https://travis-ci.org/chalk/strip-ansi.svg?branch=master )] ( https://travis-ci.org/chalk/strip-ansi )
22
3- > Strip [ ANSI escape codes] ( https://en.wikipedia.org/wiki/ANSI_escape_code )
3+ > Strip [ ANSI escape codes] ( https://en.wikipedia.org/wiki/ANSI_escape_code ) from a string
44
55---
66
You can’t perform that action at this time.
0 commit comments