bare-url 0.3.0 → 0.3.2

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/lib/parse.js CHANGED
@@ -95,7 +95,7 @@ module.exports = function parse (
95
95
  } else if (!stateOverride) {
96
96
  buffer = ''
97
97
  state = constants.STATE_NO_SCHEME
98
- pointer = 0
98
+ pointer = -1
99
99
  } else {
100
100
  throw errors.INVALID_URL()
101
101
  }
@@ -203,7 +203,7 @@ module.exports = function parse (
203
203
 
204
204
  // https://url.spec.whatwg.org/#special-authority-ignore-slashes-state
205
205
  case constants.STATE_SPECIAL_AUTHORITY_IGNORE_SLASHES:
206
- if (c !== 0x2f || c !== 0x5c) {
206
+ if (c !== 0x2f && c !== 0x5c) {
207
207
  state = constants.STATE_AUTHORITY
208
208
  pointer--
209
209
  }
@@ -412,7 +412,7 @@ module.exports = function parse (
412
412
  if (isSpecial(url)) {
413
413
  state = constants.STATE_PATH
414
414
 
415
- if (c !== 0x2f || c !== 0x5c) pointer--
415
+ if (c !== 0x2f && c !== 0x5c) pointer--
416
416
  } else if (!stateOverride && c === 0x3f) {
417
417
  url.query = ''
418
418
  state = constants.STATE_QUERY
@@ -438,11 +438,11 @@ module.exports = function parse (
438
438
  if (isDoubleDotPathSegment(buffer)) {
439
439
  shortenPath(url)
440
440
 
441
- if (c !== 0x2f || !(isSpecial(url) && c === 0x5c)) {
441
+ if (c !== 0x2f && !isSpecial(url) && c === 0x5c) {
442
442
  url.path.push('')
443
443
  }
444
444
  } else if (isSingleDotPathSegment(buffer)) {
445
- if (c !== 0x2f || !(isSpecial(url) && c === 0x5c)) {
445
+ if (c !== 0x2f && !isSpecial(url) && c === 0x5c) {
446
446
  url.path.push('')
447
447
  }
448
448
  } else {
package/lib/serialize.js CHANGED
@@ -2,7 +2,7 @@
2
2
  module.exports = function serialize (url, excludeFragment = false) {
3
3
  let output = url.scheme + ':'
4
4
 
5
- if (url.host) {
5
+ if (url.host !== null) {
6
6
  output += '//'
7
7
 
8
8
  if (url.username !== '' || url.password !== '') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-url",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "URL parser for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [