bare-url 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -32,11 +32,11 @@ const URL = exports.URL = class URL {
32
32
  // https://url.spec.whatwg.org/#dom-url-protocol
33
33
 
34
34
  get protocol () {
35
- return `${this._url.scheme}:`
35
+ return this._url.scheme + ':'
36
36
  }
37
37
 
38
38
  set protocol (value) {
39
- parse(`${value}:`, null, this._url, constants.STATE_SCHEME_START)
39
+ parse(value + ':', null, this._url, constants.STATE_SCHEME_START)
40
40
  }
41
41
 
42
42
  // https://url.spec.whatwg.org/#dom-url-username
@@ -73,7 +73,7 @@ const URL = exports.URL = class URL {
73
73
  if (this._url.host === null) return ''
74
74
  if (this._url.port === null) return this._url.host
75
75
 
76
- return `${this._url.host}:${this._url.port}`
76
+ return this._url.host + ':' + this._url.port
77
77
  }
78
78
 
79
79
  set host (value) {
@@ -101,7 +101,7 @@ const URL = exports.URL = class URL {
101
101
  get port () {
102
102
  if (this._url.port === null) return ''
103
103
 
104
- return `${this._url.port}`
104
+ return this._url.port.toString(10)
105
105
  }
106
106
 
107
107
  set port (value) {
@@ -123,7 +123,7 @@ const URL = exports.URL = class URL {
123
123
 
124
124
  let output = ''
125
125
 
126
- for (const segment of this._url.path) output += `/${segment}`
126
+ for (const segment of this._url.path) output += '/' + segment
127
127
 
128
128
  return output
129
129
  }
@@ -141,7 +141,7 @@ const URL = exports.URL = class URL {
141
141
  get search () {
142
142
  if (this._url.query === null || this._url.query === '') return ''
143
143
 
144
- return `?${this._url.query}`
144
+ return '?' + this._url.query
145
145
  }
146
146
 
147
147
  set search (value) {
@@ -165,7 +165,7 @@ const URL = exports.URL = class URL {
165
165
  get hash () {
166
166
  if (this._url.fragment === null || this._url.fragment === '') return ''
167
167
 
168
- return `#${this._url.fragment}`
168
+ return '#' + this._url.fragment
169
169
  }
170
170
 
171
171
  set hash (value) {
@@ -214,7 +214,7 @@ exports.fileURLToPath = function fileURLToPath (url) {
214
214
  const pathname = path.normalize(decodeURIComponent(url.pathname))
215
215
 
216
216
  if (os.platform() === 'win32') {
217
- if (url.hostname) return `\\\\${url.hostname}${pathname}`
217
+ if (url.hostname) return '\\\\' + url.hostname + pathname
218
218
 
219
219
  return pathname.slice(1)
220
220
  }
package/lib/parse.js CHANGED
@@ -543,7 +543,7 @@ function defaultPort (scheme) {
543
543
 
544
544
  // https://url.spec.whatwg.org/#is-special
545
545
  function isSpecial (url) {
546
- return isSpecialScheme(url)
546
+ return isSpecialScheme(url.scheme)
547
547
  }
548
548
 
549
549
  // https://url.spec.whatwg.org/#include-credentials
package/lib/serialize.js CHANGED
@@ -34,7 +34,7 @@ module.exports = function serialize (url, excludeFragment = false) {
34
34
  if (typeof url.path === 'string') {
35
35
  output += url.path
36
36
  } else {
37
- output += '/' + url.path.join('/')
37
+ for (const segment of url.path) output += '/' + segment
38
38
  }
39
39
 
40
40
  if (url.query !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-url",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "URL parser for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [