updated npm modules
This commit is contained in:
20
node_modules/url-parse/index.js
generated
vendored
20
node_modules/url-parse/index.js
generated
vendored
@@ -2,8 +2,20 @@
|
||||
|
||||
var required = require('requires-port')
|
||||
, qs = require('querystringify')
|
||||
, slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//
|
||||
, protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i
|
||||
, slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//;
|
||||
, whitespace = '[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]'
|
||||
, left = new RegExp('^'+ whitespace +'+');
|
||||
|
||||
/**
|
||||
* Trim a given string.
|
||||
*
|
||||
* @param {String} str String to trim.
|
||||
* @public
|
||||
*/
|
||||
function trimLeft(str) {
|
||||
return (str ? str : '').toString().replace(left, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* These are the parse rules for the URL parser, it informs the parser
|
||||
@@ -102,6 +114,7 @@ function lolcation(loc) {
|
||||
* @private
|
||||
*/
|
||||
function extractProtocol(address) {
|
||||
address = trimLeft(address);
|
||||
var match = protocolre.exec(address);
|
||||
|
||||
return {
|
||||
@@ -120,6 +133,8 @@ function extractProtocol(address) {
|
||||
* @private
|
||||
*/
|
||||
function resolve(relative, base) {
|
||||
if (relative === '') return base;
|
||||
|
||||
var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))
|
||||
, i = path.length
|
||||
, last = path[i - 1]
|
||||
@@ -160,6 +175,8 @@ function resolve(relative, base) {
|
||||
* @private
|
||||
*/
|
||||
function Url(address, location, parser) {
|
||||
address = trimLeft(address);
|
||||
|
||||
if (!(this instanceof Url)) {
|
||||
return new Url(address, location, parser);
|
||||
}
|
||||
@@ -427,6 +444,7 @@ Url.prototype = { set: set, toString: toString };
|
||||
//
|
||||
Url.extractProtocol = extractProtocol;
|
||||
Url.location = lolcation;
|
||||
Url.trimLeft = trimLeft;
|
||||
Url.qs = qs;
|
||||
|
||||
module.exports = Url;
|
||||
|
||||
Reference in New Issue
Block a user