Skip to content

Commit

Permalink
Require Node.js 4
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 20, 2017
1 parent 8270705 commit 0978944
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 93 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Expand Up @@ -7,9 +7,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,*.yml}]
[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
@@ -1 +1,2 @@
* text=auto
*.js text eol=lf
7 changes: 3 additions & 4 deletions .travis.yml
@@ -1,6 +1,5 @@
sudo: false
language: node_js
node_js:
- 'iojs'
- '0.12'
- '0.10'
- '8'
- '6'
- '4'
6 changes: 2 additions & 4 deletions index.js
@@ -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;
20 changes: 4 additions & 16 deletions license
@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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.
105 changes: 50 additions & 55 deletions package.json
@@ -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": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"maintainers": [
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
"Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)",
"JD Ballard <i.am.qix@gmail.com> (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": "sindresorhus@gmail.com",
"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": "*"
}
}
18 changes: 12 additions & 6 deletions readme.md
@@ -1,22 +1,22 @@
# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi)

> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)

## Install

```
$ npm install --save strip-ansi
$ npm install strip-ansi
```


## Usage

```js
var stripAnsi = require('strip-ansi');
const stripAnsi = require('strip-ansi');

stripAnsi('\u001b[4mcake\u001b[0m');
//=> 'cake'
stripAnsi('\u001B[4mUnicorn\u001B[0m');
//=> 'Unicorn'
```


Expand All @@ -28,6 +28,12 @@ stripAnsi('\u001b[4mcake\u001b[0m');
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right


## Maintainers

- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)


## License

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT
8 changes: 4 additions & 4 deletions test.js
@@ -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');
});

0 comments on commit 0978944

Please sign in to comment.