Skip to content

Commit 3669c75

Browse files
cloudheadry
authored andcommitted
removed inline require call for querystring
1 parent c86c614 commit 3669c75

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

lib/url.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
exports.parse = url_parse;
32
exports.resolve = url_resolve;
43
exports.resolveObject = url_resolveObject;
@@ -17,7 +16,7 @@ var protocolPattern = /^([a-z0-9]+:)/,
1716
"http:":true, "https:":true, "ftp:":true, "gopher:":true, "file:":true
1817
},
1918
path = require("path"), // internal module, guaranteed to be loaded already.
20-
querystring; // don't load unless necessary.
19+
querystring = require('querystring');
2120

2221
function url_parse (url, parseQueryString) {
2322
if (url && typeof(url) === "object" && url.href) return url;
@@ -75,9 +74,6 @@ function url_parse (url, parseQueryString) {
7574
out.search = rest.substr(qm);
7675
out.query = rest.substr(qm+1);
7776
if (parseQueryString) {
78-
if (!querystring) {
79-
querystring = require("querystring");
80-
}
8177
out.query = querystring.parse(out.query);
8278
}
8379
rest = rest.slice(0, qm);
@@ -105,7 +101,7 @@ function url_format (obj) {
105101
search = obj.search || (
106102
obj.query && ( "?" + (
107103
typeof(obj.query) === "object"
108-
? require("querystring").stringify(obj.query)
104+
? querystring.stringify(obj.query)
109105
: String(obj.query)
110106
))
111107
) || "",

0 commit comments

Comments
 (0)