From 027e8ae7b82e9cfa1014977988bf5a6188eeb952 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 17 Apr 2019 09:54:24 +0700 Subject: [PATCH] Require Node.js 8 --- .travis.yml | 1 - index.js | 11 +++++------ package.json | 3 +-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8eb7ffc..8777994 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,3 @@ language: node_js node_js: - '10' - '8' - - '6' diff --git a/index.js b/index.js index ca4b1d6..657a7f5 100644 --- a/index.js +++ b/index.js @@ -62,7 +62,7 @@ const main = { sevenEighths: '⅞' }; -const win = { +const windows = { tick: '√', cross: '×', star: '*', @@ -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; diff --git a/package.json b/package.json index 170aab5..03e5e92 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "sindresorhus.com" }, "engines": { - "node": ">=6" + "node": ">=8" }, "scripts": { "test": "xo && ava && tsd", @@ -26,7 +26,6 @@ "cmd", "command-line", "characters", - "char", "symbol", "symbols", "figure",