From 976f459a7f0bedab5146aa02e7e3dea66431884a Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 9 Nov 2019 13:18:23 +0700 Subject: [PATCH] Require Node.js 8 Closes #29 --- .travis.yml | 2 +- index.d.ts | 6 ++++-- index.js | 5 +---- index.test-d.ts | 4 ++-- package.json | 12 ++++++------ 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2ae9d62..f98fed0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: + - '12' - '10' - '8' - - '6' diff --git a/index.d.ts b/index.d.ts index 44e954d..907fccc 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,7 +3,7 @@ Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a @example ``` -import stripAnsi from 'strip-ansi'; +import stripAnsi = require('strip-ansi'); stripAnsi('\u001B[4mUnicorn\u001B[0m'); //=> 'Unicorn' @@ -12,4 +12,6 @@ stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); //=> 'Click' ``` */ -export default function stripAnsi(string: string): string; +declare function stripAnsi(string: string): string; + +export = stripAnsi; diff --git a/index.js b/index.js index 9788c96..9a593df 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,4 @@ 'use strict'; const ansiRegex = require('ansi-regex'); -const stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; - -module.exports = stripAnsi; -module.exports.default = stripAnsi; +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/index.test-d.ts b/index.test-d.ts index 55698d7..8b121bc 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -1,4 +1,4 @@ -import {expectType} from 'tsd-check'; -import stripAnsi from '.'; +import {expectType} from 'tsd'; +import stripAnsi = require('.'); expectType(stripAnsi('\u001B[4mcake\u001B[0m')); diff --git a/package.json b/package.json index 7494fd7..33ff313 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,10 @@ "url": "sindresorhus.com" }, "engines": { - "node": ">=6" + "node": ">=8" }, "scripts": { - "test": "xo && ava && tsd-check" + "test": "xo && ava && tsd" }, "files": [ "index.js", @@ -44,11 +44,11 @@ "text" ], "dependencies": { - "ansi-regex": "^4.1.0" + "ansi-regex": "^5.0.0" }, "devDependencies": { - "ava": "^1.3.1", - "tsd-check": "^0.5.0", - "xo": "^0.24.0" + "ava": "^2.4.0", + "tsd": "^0.10.0", + "xo": "^0.25.3" } }