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 Apr 17, 2019
1 parent a09395c commit 027e8ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -5,4 +5,3 @@ language: node_js
node_js:
- '10'
- '8'
- '6'
11 changes: 5 additions & 6 deletions index.js
Expand Up @@ -62,7 +62,7 @@ const main = {
sevenEighths: '⅞'
};

const win = {
const windows = {
tick: '√',
cross: '×',
star: '*',
Expand Down Expand Up @@ -126,20 +126,19 @@ if (platform === 'linux') {
main.questionMarkPrefix = '?';
}

const figures = platform === 'win32' ? win : main;
const figures = platform === 'win32' ? windows : main;

const fn = string => {
if (figures === main) {
return string;
}

// TODO: Use `Object.entries` when targeting Node.js 8
for (const key of Object.keys(main)) {
if (main[key] === figures[key]) {
for (const [key, value] of Object.entries(main)) {
if (value === figures[key]) {
continue;
}

string = string.replace(new RegExp(escapeStringRegexp(main[key]), 'g'), figures[key]);
string = string.replace(new RegExp(escapeStringRegexp(value), 'g'), figures[key]);
}

return string;
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -10,7 +10,7 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd",
Expand All @@ -26,7 +26,6 @@
"cmd",
"command-line",
"characters",
"char",
"symbol",
"symbols",
"figure",
Expand Down

0 comments on commit 027e8ae

Please sign in to comment.