Comparing version 1.1.8 to 1.1.9
54
index.js
'use strict'; | ||
var required = require('requires-port') | ||
, lolcation = require('./lolcation') | ||
, qs = require('querystringify') | ||
, protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i; | ||
, protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i | ||
, slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//; | ||
@@ -31,2 +31,50 @@ /** | ||
/** | ||
* These properties should not be copied or inherited from. This is only needed | ||
* for all non blob URL's as a blob URL does not include a hash, only the | ||
* origin. | ||
* | ||
* @type {Object} | ||
* @private | ||
*/ | ||
var ignore = { hash: 1, query: 1 }; | ||
/** | ||
* The location object differs when your code is loaded through a normal page, | ||
* Worker or through a worker using a blob. And with the blobble begins the | ||
* trouble as the location object will contain the URL of the blob, not the | ||
* location of the page where our code is loaded in. The actual origin is | ||
* encoded in the `pathname` so we can thankfully generate a good "default" | ||
* location from it so we can generate proper relative URL's again. | ||
* | ||
* @param {Object|String} loc Optional default location object. | ||
* @returns {Object} lolcation object. | ||
* @api public | ||
*/ | ||
function lolcation(loc) { | ||
loc = loc || global.location || {}; | ||
var finaldestination = {} | ||
, type = typeof loc | ||
, key; | ||
if ('blob:' === loc.protocol) { | ||
finaldestination = new URL(unescape(loc.pathname), {}); | ||
} else if ('string' === type) { | ||
finaldestination = new URL(loc, {}); | ||
for (key in ignore) delete finaldestination[key]; | ||
} else if ('object' === type) { | ||
for (key in loc) { | ||
if (key in ignore) continue; | ||
finaldestination[key] = loc[key]; | ||
} | ||
if (finaldestination.slashes === undefined) { | ||
finaldestination.slashes = slashes.test(loc.href); | ||
} | ||
} | ||
return finaldestination; | ||
} | ||
/** | ||
* @typedef ProtocolExtract | ||
@@ -314,3 +362,3 @@ * @type Object | ||
return url; | ||
}; | ||
} | ||
@@ -317,0 +365,0 @@ /** |
{ | ||
"name": "url-parse", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "Small footprint URL parser that works seamlessly across Node.js and browser environments", | ||
@@ -33,10 +33,10 @@ "main": "index.js", | ||
"dependencies": { | ||
"querystringify": "0.0.x", | ||
"querystringify": "~1.0.0", | ||
"requires-port": "1.0.x" | ||
}, | ||
"devDependencies": { | ||
"assume": "1.4.x", | ||
"browserify": "~14.1.0", | ||
"assume": "~1.5.0", | ||
"browserify": "~14.3.0", | ||
"istanbul": "0.4.x", | ||
"mocha": "~3.2.0", | ||
"mocha": "~3.3.0", | ||
"pre-commit": "~1.2.0", | ||
@@ -43,0 +43,0 @@ "zuul": "3.11.x" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
19468
0
137
343
+ Addedquerystringify@1.0.0(transitive)
- Removedquerystringify@0.0.4(transitive)
Updatedquerystringify@~1.0.0