summaryrefslogtreecommitdiff
path: root/lib/url.js
diff options
context:
space:
mode:
authorEduardo Leggiero <esleggiero@gmail.com>2017-07-03 08:09:11 +0100
committerRich Trott <rtrott@gmail.com>2017-07-05 09:58:47 -0700
commit8520e6f2804fad64fb50b91c80553715d3c83bd4 (patch)
treedc40a59176e32c746129adee3cd7d4623328d83a /lib/url.js
parente36917bdc159326665d1e8d14703596780ba0c3a (diff)
downloadandroid-node-v8-8520e6f2804fad64fb50b91c80553715d3c83bd4.tar.gz
android-node-v8-8520e6f2804fad64fb50b91c80553715d3c83bd4.tar.bz2
android-node-v8-8520e6f2804fad64fb50b91c80553715d3c83bd4.zip
lib: fix urlObject parameter name in url.format
Documentation, error message, and code now use the same argument name. PR-URL: https://github.com/nodejs/node/pull/14031 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/url.js')
-rw-r--r--lib/url.js25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/url.js b/lib/url.js
index fcddd4afaf..b3b05f4a89 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -550,22 +550,23 @@ function autoEscapeStr(rest) {
}
// format a parsed object into a url string
-function urlFormat(obj, options) {
+function urlFormat(urlObject, options) {
// ensure it's an object, and not a string url.
- // If it's an obj, this is a no-op.
- // this way, you can call url_format() on strings
+ // If it's an object, this is a no-op.
+ // this way, you can call urlParse() on strings
// to clean up potentially wonky urls.
- if (typeof obj === 'string') {
- obj = urlParse(obj);
- } else if (typeof obj !== 'object' || obj === null) {
- throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'urlObj', 'object', obj);
- } else if (!(obj instanceof Url)) {
- var format = obj[formatSymbol];
+ if (typeof urlObject === 'string') {
+ urlObject = urlParse(urlObject);
+ } else if (typeof urlObject !== 'object' || urlObject === null) {
+ throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'urlObject',
+ ['object', 'string'], urlObject);
+ } else if (!(urlObject instanceof Url)) {
+ var format = urlObject[formatSymbol];
return format ?
- format.call(obj, options) :
- Url.prototype.format.call(obj);
+ format.call(urlObject, options) :
+ Url.prototype.format.call(urlObject);
}
- return obj.format();
+ return urlObject.format();
}
Url.prototype.format = function format() {