Skip to content

Commit

Permalink
Require Node.js 8
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 10, 2019
1 parent cc62ac2 commit 5922c60
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 61 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
yarn.lock
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '12'
- '10'
- '8'
- '6'
- '4'
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const ansiRegex = require('ansi-regex');

// Remove the `g` flag
const re = new RegExp(ansiRegex().source);
// Removes the `g` flag
const regex = new RegExp(ansiRegex().source);

module.exports = input => re.test(input);
module.exports = string => regex.test(string);
99 changes: 49 additions & 50 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,51 @@
{
"name": "has-ansi",
"version": "3.0.0",
"description": "Check if a string has ANSI escape codes",
"license": "MIT",
"repository": "chalk/has-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"string",
"tty",
"escape",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern",
"has"
],
"dependencies": {
"ansi-regex": "^3.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "has-ansi",
"version": "3.0.0",
"description": "Check if a string has ANSI escape codes",
"license": "MIT",
"repository": "chalk/has-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"string",
"tty",
"escape",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"match",
"test",
"find",
"pattern",
"has"
],
"dependencies": {
"ansi-regex": "^4.1.0"
},
"devDependencies": {
"ava": "^2.3.0",
"xo": "^0.24.0"
}
}
8 changes: 4 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava';
import m from '.';
import hasAnsi from '.';

test(t => {
t.true(m('foo\u001B[4mcake\u001B[0m'));
t.false(m('cake'));
test('main', t => {
t.true(hasAnsi('foo\u001B[4mcake\u001B[0m'));
t.false(hasAnsi('cake'));
});

0 comments on commit 5922c60

Please sign in to comment.