Skip to content

Commit baacbab

Browse files
committed
Require Node.js 4 and meta tweaks
1 parent 7c908e7 commit baacbab

File tree

9 files changed

+152
-167
lines changed

9 files changed

+152
-167
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
99

10-
[{package.json,*.yml}]
10+
[*.yml]
1111
indent_style = space
1212
indent_size = 2

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
sudo: false
21
language: node_js
32
node_js:
3+
- '8'
44
- '6'
55
- '4'
6-
- '0.12'
7-
- '0.10'

fixtures/ansi-codes.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
'use strict';
22

3-
// from http://www.umich.edu/~archive/apple2/misc/programmers/vt100.codes.txt
3+
// From http://www.umich.edu/~archive/apple2/misc/programmers/vt100.codes.txt
44
exports.vt52Codes = {
5-
'A': ['Cursor up'],
6-
'B': ['Cursor down'],
7-
'C': ['Cursor right'],
8-
'D': ['Cursor left'],
9-
'H': ['Cursor to home'],
10-
'I': ['Reverse line feed'],
11-
'J': ['Erase to end of screen'],
12-
'K': ['Erase to end of line'],
13-
'Z': ['Identify'],
5+
A: ['Cursor up'],
6+
B: ['Cursor down'],
7+
C: ['Cursor right'],
8+
D: ['Cursor left'],
9+
H: ['Cursor to home'],
10+
I: ['Reverse line feed'],
11+
J: ['Erase to end of screen'],
12+
K: ['Erase to end of line'],
13+
Z: ['Identify'],
1414
'=': ['Enter alternate keypad mode'],
1515
'>': ['Exit alternate keypad mode'],
16-
'1': ['Graphics processor on'],
17-
'2': ['Graphics processor off'],
16+
1: ['Graphics processor on'],
17+
2: ['Graphics processor off'],
1818
'<': ['Enter ANSI mode']
1919
};
2020

21-
// from http://www.umich.edu/~archive/apple2/misc/programmers/vt100.codes.txt
21+
// From http://www.umich.edu/~archive/apple2/misc/programmers/vt100.codes.txt
2222
exports.ansiCompatible = {
2323
'[176A': ['Cursor up Pn lines'],
2424
'[176B': ['Cursor down Pn lines'],
@@ -27,8 +27,8 @@ exports.ansiCompatible = {
2727
'[176;176H': ['Direct cursor addressing, where Pl is line#, Pc is column#'],
2828
'[176;176f': ['Direct cursor addressing, where Pl is line#, Pc is column#'],
2929

30-
'7': ['Save cursor and attributes'],
31-
'8': ['Restore cursor and attributes'],
30+
7: ['Save cursor and attributes'],
31+
8: ['Restore cursor and attributes'],
3232

3333
'#3': ['Change this line to double-height top half'],
3434
'#4': ['Change this line to double-height bottom half'],
@@ -45,7 +45,7 @@ exports.ansiCompatible = {
4545
'[J': ['Erase from cursor to end of screen'],
4646
'[0J': ['Same'],
4747
'[2J': ['Erase entire screen'],
48-
'[P' : ['Delete character'],
48+
'[P': ['Delete character'],
4949
'[0P': ['Delete character (0P)'],
5050
'[2P': ['Delete 2 characters'],
5151

@@ -60,7 +60,7 @@ exports.ansiCompatible = {
6060
'(2': ['Alternative graphic ROM (Character Set G0)'],
6161
')2': ['Alternative graphic ROM (Character Set G1)'],
6262

63-
'H': ['Set tab at current column'],
63+
H: ['Set tab at current column'],
6464
'[g': ['Clear tab at current column'],
6565
'[0g': ['Same'],
6666
'[3g': ['Clear all tabs'],
@@ -72,12 +72,12 @@ exports.ansiCompatible = {
7272
'[0c': ['(response; teminal not Ok)'],
7373
'[?1;176c': ['response; where Ps is option present:'],
7474

75-
'c': ['Causes power-up reset routine to be executed'],
75+
c: ['Causes power-up reset routine to be executed'],
7676
'#8': ['Fill screen with "E"'],
7777
'[2;176y': ['Invoke Test(s), where Ps is a decimal computed by adding the numbers of the desired tests to be executed']
7878
};
7979

80-
// from http://ascii-table.com/ansi-escape-sequences-vt-100.php
80+
// From http://ascii-table.com/ansi-escape-sequences-vt-100.php
8181
exports.commonCodes = {
8282
'[176A': ['Move cursor up n lines', 'CUU'],
8383
'[176B': ['Move cursor down n lines', 'CUD'],
@@ -110,8 +110,8 @@ exports.commonCodes = {
110110
'[?8l': ['Reset auto-repeat mode', 'DECARM'],
111111
'[?9l': ['Reset interlacing mode', 'DECINLM'],
112112

113-
'N': ['Set single shift 2', 'SS2'],
114-
'O': ['Set single shift 3', 'SS3'],
113+
N: ['Set single shift 2', 'SS2'],
114+
O: ['Set single shift 3', 'SS3'],
115115

116116
'[m': ['Turn off character attributes', 'SGR0'],
117117
'[0m': ['Turn off character attributes', 'SGR0'],
@@ -151,10 +151,10 @@ exports.commonCodes = {
151151
'[;H': ['Move cursor to upper left corner', 'cursorhome'],
152152
'[f': ['Move cursor to upper left corner', 'hvhome'],
153153
'[;f': ['Move cursor to upper left corner', 'hvhome'],
154-
'M': ['Move/scroll window down one line', 'RI'],
155-
'E': ['Move to next line', 'NEL'],
154+
M: ['Move/scroll window down one line', 'RI'],
155+
E: ['Move to next line', 'NEL'],
156156

157-
'H': ['Set a tab at the current column', 'HTS'],
157+
H: ['Set a tab at the current column', 'HTS'],
158158
'[g': ['Clear a tab at the current column', 'TBC'],
159159
'[0g': ['Clear a tab at the current column', 'TBC'],
160160
'[3g': ['Clear all tabs', 'TBC'],
@@ -170,7 +170,7 @@ exports.commonCodes = {
170170

171171
'[c': ['Identify what terminal type', 'DA'],
172172
'[0c': ['Identify what terminal type (another)', 'DA'],
173-
'c': ['Reset terminal to initial state', 'RIS'],
173+
c: ['Reset terminal to initial state', 'RIS'],
174174
'[2;1y': ['Confidence power up test', 'DECTST'],
175175
'[2;2y': ['Confidence loopback test', 'DECTST'],
176176
'[2;9y': ['Repeat power up test', 'DECTST'],
@@ -182,10 +182,10 @@ exports.commonCodes = {
182182
'[4q': ['Turn on LED #4', 'DECLL4']
183183
};
184184

185-
// from http://ascii-table.com/ansi-escape-sequences-vt-100.php
185+
// From http://ascii-table.com/ansi-escape-sequences-vt-100.php
186186
exports.otherCode = {
187-
'7': ['Save cursor position and attributes', 'DECSC'],
188-
'8': ['Restore cursor position and attributes', 'DECSC'],
187+
7: ['Save cursor position and attributes', 'DECSC'],
188+
8: ['Restore cursor position and attributes', 'DECSC'],
189189

190190
'=': ['Set alternate keypad mode', 'DECKPAM'],
191191
'>': ['Set numeric keypad mode', 'DECKPNM'],

fixtures/view-codes.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
'use strict';
2-
var ansiRegex = require('../');
3-
var ansiCodes = require('./ansi-codes');
4-
var allCodes = {};
5-
var supported = [];
6-
var unsupported = [];
2+
const ansiRegex = require('..');
3+
const ansiCodes = require('./ansi-codes');
4+
5+
const allCodes = {};
6+
const supported = [];
7+
const unsupported = [];
78

89
function addCodesToTest(codes) {
9-
for (var code in codes) {
10+
for (const code in codes) {
1011
allCodes[code] = codes[code];
1112
}
1213
}
1314

1415
function identifySupportedCodes() {
15-
var codeSupport = {};
16+
let codeSupport = {};
1617

17-
for (var code in allCodes) {
18+
for (const code in allCodes) {
1819
codeSupport = {
19-
code: code,
20-
matches: ('\u001b' + code).match(ansiRegex()),
20+
code,
21+
matches: `\u001B${code}`.match(ansiRegex()),
2122
description: allCodes[code][0]
2223
};
2324

24-
if (codeSupport.matches !== null && codeSupport.matches[0] === '\u001b' + code) {
25+
if (codeSupport.matches !== null && codeSupport.matches[0] === `\u001B${code}`) {
2526
supported.push(codeSupport);
2627
} else {
2728
unsupported.push(codeSupport);
@@ -30,21 +31,21 @@ function identifySupportedCodes() {
3031
}
3132

3233
function displaySupport() {
33-
process.stdout.write('\u001b[32m');
34+
process.stdout.write('\u001B[32m');
3435

3536
console.log('SUPPORTED');
36-
for (var i = 0; i < supported.length; i++) {
37-
console.log(supported[i]);
37+
for (const el of supported) {
38+
console.log(el);
3839
}
3940

40-
process.stdout.write('\u001b[31m');
41+
process.stdout.write('\u001B[31m');
4142
console.log('UNSUPPORTED');
4243

43-
for (var j = 0; j < unsupported.length; j++) {
44-
console.log(unsupported[j]);
44+
for (const el of unsupported) {
45+
console.log(el);
4546
}
4647

47-
process.stdout.write('\u001b[0m');
48+
process.stdout.write('\u001B[0m');
4849
}
4950

5051
addCodesToTest(ansiCodes.vt52Codes);

index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
'use strict';
2-
module.exports = function () {
3-
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
4-
};
2+
module.exports = () => (/[\u001B\u009B][[()#;?]*(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PRZcf-nqry=><]/g);

license

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
The MIT License (MIT)
1+
MIT License
22

33
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
5+
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:
116

12-
The above copyright notice and this permission notice shall be included in
13-
all copies or substantial portions of the Software.
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
148

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
9+
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.

package.json

Lines changed: 56 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,58 @@
11
{
2-
"name": "ansi-regex",
3-
"version": "2.1.1",
4-
"description": "Regular expression for matching ANSI escape codes",
5-
"license": "MIT",
6-
"repository": "chalk/ansi-regex",
7-
"author": {
8-
"name": "Sindre Sorhus",
9-
"email": "sindresorhus@gmail.com",
10-
"url": "sindresorhus.com"
11-
},
12-
"maintainers": [
13-
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
14-
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)",
15-
"JD Ballard <i.am.qix@gmail.com> (github.com/qix-)"
16-
],
17-
"engines": {
18-
"node": ">=0.10.0"
19-
},
20-
"scripts": {
21-
"test": "xo && ava --verbose",
22-
"view-supported": "node fixtures/view-codes.js"
23-
},
24-
"files": [
25-
"index.js"
26-
],
27-
"keywords": [
28-
"ansi",
29-
"styles",
30-
"color",
31-
"colour",
32-
"colors",
33-
"terminal",
34-
"console",
35-
"cli",
36-
"string",
37-
"tty",
38-
"escape",
39-
"formatting",
40-
"rgb",
41-
"256",
42-
"shell",
43-
"xterm",
44-
"command-line",
45-
"text",
46-
"regex",
47-
"regexp",
48-
"re",
49-
"match",
50-
"test",
51-
"find",
52-
"pattern"
53-
],
54-
"devDependencies": {
55-
"ava": "0.17.0",
56-
"xo": "0.16.0"
57-
},
58-
"xo": {
59-
"rules": {
60-
"guard-for-in": 0,
61-
"no-loop-func": 0
62-
}
63-
}
2+
"name": "ansi-regex",
3+
"version": "2.1.1",
4+
"description": "Regular expression for matching ANSI escape codes",
5+
"license": "MIT",
6+
"repository": "chalk/ansi-regex",
7+
"author": {
8+
"name": "Sindre Sorhus",
9+
"email": "sindresorhus@gmail.com",
10+
"url": "sindresorhus.com"
11+
},
12+
"engines": {
13+
"node": ">=4"
14+
},
15+
"scripts": {
16+
"test": "xo && ava",
17+
"view-supported": "node fixtures/view-codes.js"
18+
},
19+
"files": [
20+
"index.js"
21+
],
22+
"keywords": [
23+
"ansi",
24+
"styles",
25+
"color",
26+
"colour",
27+
"colors",
28+
"terminal",
29+
"console",
30+
"cli",
31+
"string",
32+
"tty",
33+
"escape",
34+
"formatting",
35+
"rgb",
36+
"256",
37+
"shell",
38+
"xterm",
39+
"command-line",
40+
"text",
41+
"regex",
42+
"regexp",
43+
"re",
44+
"match",
45+
"test",
46+
"find",
47+
"pattern"
48+
],
49+
"devDependencies": {
50+
"ava": "*",
51+
"xo": "*"
52+
},
53+
"xo": {
54+
"rules": {
55+
"guard-for-in": 0
56+
}
57+
}
6458
}

0 commit comments

Comments
 (0)