File tree 5 files changed +17
-6
lines changed
5 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1
1
/**
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
+ ```
3
14
*/
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 1
1
'use strict' ;
2
2
const ansiRegex = require ( 'ansi-regex' ) ;
3
3
4
- const stripAnsi = input => typeof input === 'string' ? input . replace ( ansiRegex ( ) , '' ) : input ;
4
+ const stripAnsi = string => typeof string === 'string' ? string . replace ( ansiRegex ( ) , '' ) : string ;
5
5
6
6
module . exports = stripAnsi ;
7
7
module . exports . default = stripAnsi ;
Original file line number Diff line number Diff line change 1
1
import { expectType } from 'tsd-check' ;
2
2
import stripAnsi from '.' ;
3
3
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 1
1
{
2
2
"name" : " strip-ansi" ,
3
3
"version" : " 5.1.0" ,
4
- "description" : " Strip ANSI escape codes" ,
4
+ "description" : " Strip ANSI escape codes from a string " ,
5
5
"license" : " MIT" ,
6
6
"repository" : " chalk/strip-ansi" ,
7
7
"author" : {
Original file line number Diff line number Diff line change 1
1
# strip-ansi [ ![ Build Status] ( https://travis-ci.org/chalk/strip-ansi.svg?branch=master )] ( https://travis-ci.org/chalk/strip-ansi )
2
2
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
4
4
5
5
---
6
6
You can’t perform that action at this time.
0 commit comments