bare-url 0.2.0 → 0.3.1

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
@@ -1,4 +1,5 @@
1
1
  const path = require('bare-path')
2
+ const os = require('bare-os')
2
3
  const constants = require('./lib/constants')
3
4
  const errors = require('./lib/errors')
4
5
  const parse = require('./lib/parse')
@@ -212,7 +213,7 @@ exports.fileURLToPath = function fileURLToPath (url) {
212
213
 
213
214
  const pathname = path.normalize(decodeURIComponent(url.pathname))
214
215
 
215
- if (process.platform === 'win32') {
216
+ if (os.platform() === 'win32') {
216
217
  if (url.hostname) return `\\\\${url.hostname}${pathname}`
217
218
 
218
219
  return pathname.slice(1)
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
  }
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.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "URL parser for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -21,7 +21,8 @@
21
21
  },
22
22
  "homepage": "https://github.com/holepunchto/bare-url",
23
23
  "dependencies": {
24
- "bare-path": "^1.1.2"
24
+ "bare-os": "^2.0.0",
25
+ "bare-path": "^2.0.0"
25
26
  },
26
27
  "devDependencies": {
27
28
  "brittle": "^3.3.2",