Skip to content

Commit

Permalink
Require Node.js 10 (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound authored Jan 31, 2020
1 parent 062b426 commit 7b4ad64
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ language: node_js
node_js:
- '12'
- '10'
- '8'
after_success:
- './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls'
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
'use strict';
// TODO: Use the `URL` global when targeting Node.js 10
const URLParser = typeof URL === 'undefined' ? require('url').URL : URL;

// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
const DATA_URL_DEFAULT_MIME_TYPE = 'text/plain';
Expand Down Expand Up @@ -106,7 +104,7 @@ const normalizeUrl = (urlString, options) => {
urlString = urlString.replace(/^(?!(?:\w+:)?\/\/)|^\/\//, options.defaultProtocol);
}

const urlObj = new URLParser(urlString);
const urlObj = new URL(urlString);

if (options.forceHttp && options.forceHttps) {
throw new Error('The `forceHttp` and `forceHttps` options cannot be used together');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"scripts": {
"test": "xo && nyc ava && tsd"
Expand Down

0 comments on commit 7b4ad64

Please sign in to comment.