Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 12, 2020
1 parent a0848a0 commit 97423df
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
4 changes: 4 additions & 0 deletions .github/funding.yml
@@ -0,0 +1,4 @@
github: sindresorhus
open_collective: sindresorhus
patreon: sindresorhus
custom: https://sindresorhus.com/donate
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,4 +1,4 @@
language: node_js
node_js:
- '12'
- '10'
- '8'
10 changes: 3 additions & 7 deletions index.js
Expand Up @@ -8,17 +8,13 @@ const statusCodes = {
};

module.exports = async url => {
url = new URL(url);
url = encodeURIComponent(url.host);
const hostname = encodeURIComponent((new URL(url)).hostname);

const {body} = await got(`https://isitup.org/${url}.json`, {
json: true,
const {status_code: statusCode} = await got(`https://isitup.org/${hostname}.json`, {
headers: {
'user-agent': 'https://github.com/sindresorhus/is-up'
}
});

const statusCode = body.status_code;
}).json();

if (statusCode === statusCodes.invalidDomain) {
throw new Error('Invalid domain');
Expand Down
11 changes: 6 additions & 5 deletions package.json
Expand Up @@ -4,13 +4,14 @@
"description": "Check whether a website is up or down",
"license": "MIT",
"repository": "sindresorhus/is-up",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -30,11 +31,11 @@
"offline"
],
"dependencies": {
"got": "^9.3.1"
"got": "^10.5.5"
},
"devDependencies": {
"ava": "^1.0.0-rc.1",
"unique-string": "^1.0.0",
"xo": "^0.23.0"
"ava": "^1.0.0",
"unique-string": "^2.0.0",
"xo": "^0.25.4"
}
}
8 changes: 0 additions & 8 deletions readme.md
Expand Up @@ -2,14 +2,12 @@

> Check whether a website is up or down using the [isitup.org](https://isitup.org) API

## Install

```
$ npm install is-up
```


## Usage

```js
Expand All @@ -20,15 +18,9 @@ const isUp = require('is-up');
//=> true
})();
```

*Specifying the protocol is optional.*


## Related

- [is-up-cli](https://github.com/sindresorhus/is-up-cli) - CLI for this module


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)

0 comments on commit 97423df

Please sign in to comment.