diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c1870cf..d36e1a8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,10 +12,9 @@ jobs: node-version: - 14 - 12 - - 10 steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - run: npm install diff --git a/index.d.ts b/index.d.ts index 275b37b..944a878 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,12 +3,10 @@ Detect whether the terminal supports Unicode. @example ``` -import isUnicodeSupported = require('is-unicode-supported'); +import isUnicodeSupported from 'is-unicode-supported'; isUnicodeSupported(); //=> true ``` */ -declare function isUnicodeSupported(): boolean; - -export = isUnicodeSupported; +export default function isUnicodeSupported(): boolean; diff --git a/index.js b/index.js index b5a11be..fca0d36 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,4 @@ -'use strict'; - -module.exports = () => { +export default function isUnicodeSupported() { if (process.platform !== 'win32') { return true; } @@ -10,4 +8,4 @@ module.exports = () => { process.env.TERM_PROGRAM === 'vscode' || process.env.TERM === 'xterm-256color' || process.env.TERM === 'alacritty'; -}; +} diff --git a/index.test-d.ts b/index.test-d.ts index 636ca56..634fb85 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -1,4 +1,4 @@ import {expectType} from 'tsd'; -import isUnicodeSupported = require('.'); +import isUnicodeSupported from './index.js'; expectType(isUnicodeSupported()); diff --git a/package.json b/package.json index 17e4035..5d13355 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,10 @@ "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, + "type": "module", + "exports": "./index.js", "engines": { - "node": ">=10" + "node": ">=12" }, "scripts": { "test": "xo && ava && tsd" @@ -34,7 +36,7 @@ "detection" ], "devDependencies": { - "ava": "^2.4.0", + "ava": "^3.15.0", "tsd": "^0.14.0", "xo": "^0.38.2" } diff --git a/readme.md b/readme.md index a82e34d..d34064d 100644 --- a/readme.md +++ b/readme.md @@ -15,7 +15,7 @@ $ npm install is-unicode-supported ## Usage ```js -const isUnicodeSupported = require('is-unicode-supported'); +import isUnicodeSupported from 'is-unicode-supported'; isUnicodeSupported(); //=> true