Skip to content

Commit 97423df

Browse files
committed
Require Node.js 10
1 parent a0848a0 commit 97423df

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

.github/funding.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github: sindresorhus
2+
open_collective: sindresorhus
3+
patreon: sindresorhus
4+
custom: https://sindresorhus.com/donate

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
language: node_js
22
node_js:
3+
- '12'
34
- '10'
4-
- '8'

index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@ const statusCodes = {
88
};
99

1010
module.exports = async url => {
11-
url = new URL(url);
12-
url = encodeURIComponent(url.host);
11+
const hostname = encodeURIComponent((new URL(url)).hostname);
1312

14-
const {body} = await got(`https://isitup.org/${url}.json`, {
15-
json: true,
13+
const {status_code: statusCode} = await got(`https://isitup.org/${hostname}.json`, {
1614
headers: {
1715
'user-agent': 'https://github.com/sindresorhus/is-up'
1816
}
19-
});
20-
21-
const statusCode = body.status_code;
17+
}).json();
2218

2319
if (statusCode === statusCodes.invalidDomain) {
2420
throw new Error('Invalid domain');

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
"description": "Check whether a website is up or down",
55
"license": "MIT",
66
"repository": "sindresorhus/is-up",
7+
"funding": "https://github.com/sponsors/sindresorhus",
78
"author": {
89
"name": "Sindre Sorhus",
910
"email": "[email protected]",
1011
"url": "sindresorhus.com"
1112
},
1213
"engines": {
13-
"node": ">=8"
14+
"node": ">=10"
1415
},
1516
"scripts": {
1617
"test": "xo && ava"
@@ -30,11 +31,11 @@
3031
"offline"
3132
],
3233
"dependencies": {
33-
"got": "^9.3.1"
34+
"got": "^10.5.5"
3435
},
3536
"devDependencies": {
36-
"ava": "^1.0.0-rc.1",
37-
"unique-string": "^1.0.0",
38-
"xo": "^0.23.0"
37+
"ava": "^1.0.0",
38+
"unique-string": "^2.0.0",
39+
"xo": "^0.25.4"
3940
}
4041
}

readme.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
> Check whether a website is up or down using the [isitup.org](https://isitup.org) API
44
5-
65
## Install
76

87
```
98
$ npm install is-up
109
```
1110

12-
1311
## Usage
1412

1513
```js
@@ -20,15 +18,9 @@ const isUp = require('is-up');
2018
//=> true
2119
})();
2220
```
23-
2421
*Specifying the protocol is optional.*
2522

2623

2724
## Related
2825

2926
- [is-up-cli](https://github.com/sindresorhus/is-up-cli) - CLI for this module
30-
31-
32-
## License
33-
34-
MIT © [Sindre Sorhus](https://sindresorhus.com)

0 commit comments

Comments
 (0)