diff options
Diffstat (limited to 'lib/url.js')
-rw-r--r-- | lib/url.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/url.js b/lib/url.js index fc3863f6ef..316b2a12ee 100644 --- a/lib/url.js +++ b/lib/url.js @@ -21,7 +21,11 @@ 'use strict'; -const { Object, SafeSet } = primordials; +const { + ObjectCreate, + ObjectKeys, + SafeSet, +} = primordials; const { toASCII } = require('internal/idna'); const { encodeStr, hexTable } = require('internal/querystring'); @@ -248,7 +252,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { } } else if (parseQueryString) { this.search = null; - this.query = Object.create(null); + this.query = ObjectCreate(null); } return this; } @@ -437,7 +441,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { } else if (parseQueryString) { // No query string, but parseQueryString still requested this.search = null; - this.query = Object.create(null); + this.query = ObjectCreate(null); } const useQuestionIdx = @@ -677,7 +681,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { } const result = new Url(); - const tkeys = Object.keys(this); + const tkeys = ObjectKeys(this); for (let tk = 0; tk < tkeys.length; tk++) { const tkey = tkeys[tk]; result[tkey] = this[tkey]; @@ -696,7 +700,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { // Hrefs like //foo/bar always cut to the protocol. if (relative.slashes && !relative.protocol) { // Take everything except the protocol from relative - const rkeys = Object.keys(relative); + const rkeys = ObjectKeys(relative); for (let rk = 0; rk < rkeys.length; rk++) { const rkey = rkeys[rk]; if (rkey !== 'protocol') @@ -723,7 +727,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { // because that's known to be hostless. // anything else is assumed to be absolute. if (!slashedProtocol.has(relative.protocol)) { - const keys = Object.keys(relative); + const keys = ObjectKeys(relative); for (let v = 0; v < keys.length; v++) { const k = keys[v]; result[k] = relative[k]; |