-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8270705
commit 0978944
Showing
8 changed files
with
77 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
* text=auto | ||
*.js text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- 'iojs' | ||
- '0.12' | ||
- '0.10' | ||
- '8' | ||
- '6' | ||
- '4' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
'use strict'; | ||
var ansiRegex = require('ansi-regex')(); | ||
const ansiRegex = require('ansi-regex'); | ||
|
||
module.exports = function (str) { | ||
return typeof str === 'string' ? str.replace(ansiRegex, '') : str; | ||
}; | ||
module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,9 @@ | ||
The MIT License (MIT) | ||
MIT License | ||
|
||
Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,52 @@ | ||
{ | ||
"name": "strip-ansi", | ||
"version": "3.0.1", | ||
"description": "Strip ANSI escape codes", | ||
"license": "MIT", | ||
"repository": "chalk/strip-ansi", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "[email protected]", | ||
"url": "sindresorhus.com" | ||
}, | ||
"maintainers": [ | ||
"Sindre Sorhus <[email protected]> (sindresorhus.com)", | ||
"Joshua Boy Nicolai Appelman <[email protected]> (jbna.nl)", | ||
"JD Ballard <[email protected]> (github.com/qix-)" | ||
], | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"strip", | ||
"trim", | ||
"remove", | ||
"ansi", | ||
"styles", | ||
"color", | ||
"colour", | ||
"colors", | ||
"terminal", | ||
"console", | ||
"string", | ||
"tty", | ||
"escape", | ||
"formatting", | ||
"rgb", | ||
"256", | ||
"shell", | ||
"xterm", | ||
"log", | ||
"logging", | ||
"command-line", | ||
"text" | ||
], | ||
"dependencies": { | ||
"ansi-regex": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
"name": "strip-ansi", | ||
"version": "3.0.1", | ||
"description": "Strip ANSI escape codes", | ||
"license": "MIT", | ||
"repository": "chalk/strip-ansi", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "[email protected]", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"strip", | ||
"trim", | ||
"remove", | ||
"ansi", | ||
"styles", | ||
"color", | ||
"colour", | ||
"colors", | ||
"terminal", | ||
"console", | ||
"string", | ||
"tty", | ||
"escape", | ||
"formatting", | ||
"rgb", | ||
"256", | ||
"shell", | ||
"xterm", | ||
"log", | ||
"logging", | ||
"command-line", | ||
"text" | ||
], | ||
"dependencies": { | ||
"ansi-regex": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import test from 'ava'; | ||
import fn from './'; | ||
import m from '.'; | ||
|
||
test('strip color from string', t => { | ||
t.is(fn('\u001b[0m\u001b[4m\u001b[42m\u001b[31mfoo\u001b[39m\u001b[49m\u001b[24mfoo\u001b[0m'), 'foofoo'); | ||
t.is(m('\u001B[0m\u001B[4m\u001B[42m\u001B[31mfoo\u001B[39m\u001B[49m\u001B[24mfoo\u001B[0m'), 'foofoo'); | ||
}); | ||
|
||
test('strip color from ls command', t => { | ||
t.is(fn('\u001b[00;38;5;244m\u001b[m\u001b[00;38;5;33mfoo\u001b[0m'), 'foo'); | ||
t.is(m('\u001B[00;38;5;244m\u001B[m\u001B[00;38;5;33mfoo\u001B[0m'), 'foo'); | ||
}); | ||
test('strip reset;setfg;setbg;italics;strike;underline sequence from string', t => { | ||
t.is(fn('\x1b[0;33;49;3;9;4mbar\x1b[0m'), 'bar'); | ||
t.is(m('\u001B[0;33;49;3;9;4mbar\u001B[0m'), 'bar'); | ||
}); |