Skip to content

Commit 30ba81f

Browse files
committed
Require Node.js 12 and move to ESM
1 parent 73d12af commit 30ba81f

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

.github/workflows/main.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ jobs:
1212
node-version:
1313
- 14
1414
- 12
15-
- 10
1615
steps:
1716
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v1
17+
- uses: actions/setup-node@v2
1918
with:
2019
node-version: ${{ matrix.node-version }}
2120
- run: npm install

index.d.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ Detect whether the terminal supports Unicode.
33
44
@example
55
```
6-
import isUnicodeSupported = require('is-unicode-supported');
6+
import isUnicodeSupported from 'is-unicode-supported';
77
88
isUnicodeSupported();
99
//=> true
1010
```
1111
*/
12-
declare function isUnicodeSupported(): boolean;
13-
14-
export = isUnicodeSupported;
12+
export default function isUnicodeSupported(): boolean;

index.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
'use strict';
2-
3-
module.exports = () => {
1+
export default function isUnicodeSupported() {
42
if (process.platform !== 'win32') {
53
return true;
64
}
@@ -10,4 +8,4 @@ module.exports = () => {
108
process.env.TERM_PROGRAM === 'vscode' ||
119
process.env.TERM === 'xterm-256color' ||
1210
process.env.TERM === 'alacritty';
13-
};
11+
}

index.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import {expectType} from 'tsd';
2-
import isUnicodeSupported = require('.');
2+
import isUnicodeSupported from './index.js';
33

44
expectType<boolean>(isUnicodeSupported());

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
"email": "[email protected]",
1111
"url": "https://sindresorhus.com"
1212
},
13+
"type": "module",
14+
"exports": "./index.js",
1315
"engines": {
14-
"node": ">=10"
16+
"node": ">=12"
1517
},
1618
"scripts": {
1719
"test": "xo && ava && tsd"
@@ -34,7 +36,7 @@
3436
"detection"
3537
],
3638
"devDependencies": {
37-
"ava": "^2.4.0",
39+
"ava": "^3.15.0",
3840
"tsd": "^0.14.0",
3941
"xo": "^0.38.2"
4042
}

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ npm install is-unicode-supported
1515
## Usage
1616

1717
```js
18-
const isUnicodeSupported = require('is-unicode-supported');
18+
import isUnicodeSupported from 'is-unicode-supported';
1919

2020
isUnicodeSupported();
2121
//=> true

0 commit comments

Comments
 (0)