summaryrefslogtreecommitdiff
path: root/lib/url.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/url.js')
-rw-r--r--lib/url.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/url.js b/lib/url.js
index 29dec5cc5f..c34eee638c 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -31,6 +31,7 @@ const { SafeSet } = require('internal/safe_globals');
const {
ERR_INVALID_ARG_TYPE
} = require('internal/errors').codes;
+const { validateString } = require('internal/validators');
// This ensures setURLConstructor() is called before the native
// URL::ToObject() method is used.
@@ -150,9 +151,7 @@ function urlParse(url, parseQueryString, slashesDenoteHost) {
}
Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
- if (typeof url !== 'string') {
- throw new ERR_INVALID_ARG_TYPE('url', 'string', url);
- }
+ validateString(url, 'url');
// Copy chrome, IE, opera backslash-handling behavior.
// Back slashes before the query string get converted to forward slashes