Skip to content

Commit 7c9bae1

Browse files
committed
Require Node.js 18 and move to ESM
1 parent 4d30105 commit 7c9bae1

File tree

9 files changed

+30
-48
lines changed

9 files changed

+30
-48
lines changed

Diff for: .github/funding.yml

-2
This file was deleted.

Diff for: .github/workflows/main.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 14
14-
- 12
15-
- 10
16-
- 8
13+
- 20
14+
- 18
1715
steps:
18-
- uses: actions/checkout@v2
19-
- uses: actions/setup-node@v1
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
2018
with:
2119
node-version: ${{ matrix.node-version }}
2220
- run: npm install

Diff for: index.d.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Check if a file path is a binary file.
33
44
@example
55
```
6-
import isBinaryPath = require('is-binary-path');
6+
import isBinaryPath from 'is-binary-path';
77
88
isBinaryPath('source/unicorn.png');
99
//=> true
@@ -12,6 +12,4 @@ isBinaryPath('source/unicorn.txt');
1212
//=> false
1313
```
1414
*/
15-
declare function isBinaryPath(filePath: string): boolean;
16-
17-
export = isBinaryPath;
15+
export default function isBinaryPath(filePath: string): boolean;

Diff for: index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
'use strict';
2-
const path = require('path');
3-
const binaryExtensions = require('binary-extensions');
1+
import path from 'node:path';
2+
import binaryExtensions from 'binary-extensions';
43

54
const extensions = new Set(binaryExtensions);
65

7-
module.exports = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase());
6+
export default function isBinaryPath(filePath) {
7+
return extensions.has(path.extname(filePath).slice(1).toLowerCase());
8+
}

Diff for: index.test-d.ts

-4
This file was deleted.

Diff for: license

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
MIT License
22

3-
Copyright (c) 2019 Sindre Sorhus <[email protected]> (https://sindresorhus.com), Paul Miller (https://paulmillr.com)
3+
Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)
4+
Copyright (c) Paul Miller (https://paulmillr.com)
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
67

Diff for: package.json

+13-7
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,23 @@
44
"description": "Check if a file path is a binary file",
55
"license": "MIT",
66
"repository": "sindresorhus/is-binary-path",
7+
"funding": "https://github.com/sponsors/sindresorhus",
78
"author": {
89
"name": "Sindre Sorhus",
910
"email": "[email protected]",
10-
"url": "sindresorhus.com"
11+
"url": "https://sindresorhus.com"
1112
},
13+
"type": "module",
14+
"exports": {
15+
"types": "./index.d.ts",
16+
"default": "./index.js"
17+
},
18+
"sideEffects": false,
1219
"engines": {
13-
"node": ">=8"
20+
"node": ">=18.20"
1421
},
1522
"scripts": {
16-
"test": "xo && ava && tsd"
23+
"test": "xo && ava"
1724
},
1825
"files": [
1926
"index.js",
@@ -30,11 +37,10 @@
3037
"is"
3138
],
3239
"dependencies": {
33-
"binary-extensions": "^2.0.0"
40+
"binary-extensions": "^3.0.0"
3441
},
3542
"devDependencies": {
36-
"ava": "^1.4.1",
37-
"tsd": "^0.7.2",
38-
"xo": "^0.24.0"
43+
"ava": "^6.1.2",
44+
"xo": "^0.58.0"
3945
}
4046
}

Diff for: readme.md

+3-19
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22

33
> Check if a file path is a binary file
44
5-
65
## Install
76

8-
```
9-
$ npm install is-binary-path
7+
```sh
8+
npm install is-binary-path
109
```
1110

12-
1311
## Usage
1412

1513
```js
16-
const isBinaryPath = require('is-binary-path');
14+
import isBinaryPath from 'is-binary-path';
1715

1816
isBinaryPath('source/unicorn.png');
1917
//=> true
@@ -22,21 +20,7 @@ isBinaryPath('source/unicorn.txt');
2220
//=> false
2321
```
2422

25-
2623
## Related
2724

2825
- [binary-extensions](https://github.com/sindresorhus/binary-extensions) - List of binary file extensions
2926
- [is-text-path](https://github.com/sindresorhus/is-text-path) - Check if a filepath is a text file
30-
31-
32-
---
33-
34-
<div align="center">
35-
<b>
36-
<a href="https://tidelift.com/subscription/pkg/npm-is-binary-path?utm_source=npm-is-binary-path&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
37-
</b>
38-
<br>
39-
<sub>
40-
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
41-
</sub>
42-
</div>

Diff for: test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import isBinaryPath from '.';
2+
import isBinaryPath from './index.js';
33

44
test('main', t => {
55
t.true(isBinaryPath('unicorn.png'));

0 commit comments

Comments
 (0)