Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

url-parse

Package Overview
Dependencies
Maintainers
4
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

url-parse - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

21

dist/url-parse.js

@@ -445,12 +445,15 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.URLParse = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){

//
// Little nifty parsing hack, leverage the fact that RegExp.exec increments
// the lastIndex property so we can continue executing this loop until we've
// parsed all results.
//
for (;
part = parser.exec(query);
result[decode(part[1])] = decode(part[2])
);
while (part = parser.exec(query)) {
var key = decode(part[1])
, value = decode(part[2]);
//
// Prevent overriding of existing properties. This ensures that build-in
// methods like `toString` or __proto__ are not overriden by malicious
// querystrings.
//
if (key in result) continue;
result[key] = value;
}
return result;

@@ -457,0 +460,0 @@ }

@@ -1,1 +0,1 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).URLParse=e()}}(function(){return function s(a,i,p){function c(t,e){if(!i[t]){if(!a[t]){var o="function"==typeof require&&require;if(!e&&o)return o(t,!0);if(f)return f(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var n=i[t]={exports:{}};a[t][0].call(n.exports,function(e){return c(a[t][1][e]||e)},n,n.exports,s,a,i,p)}return i[t].exports}for(var f="function"==typeof require&&require,e=0;e<p.length;e++)c(p[e]);return c}({1:[function(e,t,o){(function(n){"use strict";var h=e("requires-port"),d=e("querystringify"),o=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,s=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,y=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],a={hash:1,query:1};function m(e){var t,o={},r=typeof(e=e||n.location||{});if("blob:"===e.protocol)o=new w(unescape(e.pathname),{});else if("string"===r)for(t in o=new w(e,{}),a)delete o[t];else if("object"===r){for(t in e)t in a||(o[t]=e[t]);void 0===o.slashes&&(o.slashes=s.test(e.href))}return o}function g(e){var t=o.exec(e);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!t[2],rest:t[3]}}function w(e,t,o){if(!(this instanceof w))return new w(e,t,o);var r,n,s,a,i,p,c=y.slice(),f=typeof t,l=this,u=0;for("object"!==f&&"string"!==f&&(o=t,t=null),o&&"function"!=typeof o&&(o=d.parse),t=m(t),r=!(n=g(e||"")).protocol&&!n.slashes,l.slashes=n.slashes||r&&t.slashes,l.protocol=n.protocol||t.protocol||"",e=n.rest,n.slashes||(c[2]=[/(.*)/,"pathname"]);u<c.length;u++)s=(a=c[u])[0],p=a[1],s!=s?l[p]=e:"string"==typeof s?~(i=e.indexOf(s))&&("number"==typeof a[2]?(l[p]=e.slice(0,i),e=e.slice(i+a[2])):(l[p]=e.slice(i),e=e.slice(0,i))):(i=s.exec(e))&&(l[p]=i[1],e=e.slice(0,i.index)),l[p]=l[p]||r&&a[3]&&t[p]||"",a[4]&&(l[p]=l[p].toLowerCase());o&&(l.query=o(l.query)),r&&t.slashes&&"/"!==l.pathname.charAt(0)&&(""!==l.pathname||""!==t.pathname)&&(l.pathname=function(e,t){for(var o=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=o.length,n=o[r-1],s=!1,a=0;r--;)"."===o[r]?o.splice(r,1):".."===o[r]?(o.splice(r,1),a++):a&&(0===r&&(s=!0),o.splice(r,1),a--);return s&&o.unshift(""),"."!==n&&".."!==n||o.push(""),o.join("/")}(l.pathname,t.pathname)),h(l.port,l.protocol)||(l.host=l.hostname,l.port=""),l.username=l.password="",l.auth&&(a=l.auth.split(":"),l.username=a[0]||"",l.password=a[1]||""),l.origin=l.protocol&&l.host&&"file:"!==l.protocol?l.protocol+"//"+l.host:"null",l.href=l.toString()}w.prototype={set:function(e,t,o){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(o||d.parse)(t)),r[e]=t;break;case"port":r[e]=t,h(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!o;break;case"pathname":case"hash":if(t){var n="pathname"===e?"/":"#";r[e]=t.charAt(0)!==n?n+t:t}else r[e]=t;break;default:r[e]=t}for(var s=0;s<y.length;s++){var a=y[s];a[4]&&(r[a[1]]=r[a[1]].toLowerCase())}return r.origin=r.protocol&&r.host&&"file:"!==r.protocol?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=d.stringify);var t,o=this,r=o.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var n=r+(o.slashes?"//":"");return o.username&&(n+=o.username,o.password&&(n+=":"+o.password),n+="@"),n+=o.host+o.pathname,(t="object"==typeof o.query?e(o.query):o.query)&&(n+="?"!==t.charAt(0)?"?"+t:t),o.hash&&(n+=o.hash),n}},w.extractProtocol=g,w.location=m,w.qs=d,t.exports=w}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:2,"requires-port":3}],2:[function(e,t,o){"use strict";var n=Object.prototype.hasOwnProperty;function s(e){return decodeURIComponent(e.replace(/\+/g," "))}o.stringify=function(e,t){t=t||"";var o=[];for(var r in"string"!=typeof t&&(t="?"),e)n.call(e,r)&&o.push(encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return o.length?t+o.join("&"):""},o.parse=function(e){for(var t,o=/([^=?&]+)=?([^&]*)/g,r={};t=o.exec(e);r[s(t[1])]=s(t[2]));return r}},{}],3:[function(e,t,o){"use strict";t.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},{}]},{},[1])(1)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).URLParse=e()}}(function(){return function s(a,i,p){function c(t,e){if(!i[t]){if(!a[t]){var o="function"==typeof require&&require;if(!e&&o)return o(t,!0);if(f)return f(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var n=i[t]={exports:{}};a[t][0].call(n.exports,function(e){return c(a[t][1][e]||e)},n,n.exports,s,a,i,p)}return i[t].exports}for(var f="function"==typeof require&&require,e=0;e<p.length;e++)c(p[e]);return c}({1:[function(e,t,o){(function(n){"use strict";var h=e("requires-port"),d=e("querystringify"),o=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,s=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,y=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],a={hash:1,query:1};function m(e){var t,o={},r=typeof(e=e||n.location||{});if("blob:"===e.protocol)o=new w(unescape(e.pathname),{});else if("string"===r)for(t in o=new w(e,{}),a)delete o[t];else if("object"===r){for(t in e)t in a||(o[t]=e[t]);void 0===o.slashes&&(o.slashes=s.test(e.href))}return o}function g(e){var t=o.exec(e);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!t[2],rest:t[3]}}function w(e,t,o){if(!(this instanceof w))return new w(e,t,o);var r,n,s,a,i,p,c=y.slice(),f=typeof t,l=this,u=0;for("object"!==f&&"string"!==f&&(o=t,t=null),o&&"function"!=typeof o&&(o=d.parse),t=m(t),r=!(n=g(e||"")).protocol&&!n.slashes,l.slashes=n.slashes||r&&t.slashes,l.protocol=n.protocol||t.protocol||"",e=n.rest,n.slashes||(c[2]=[/(.*)/,"pathname"]);u<c.length;u++)s=(a=c[u])[0],p=a[1],s!=s?l[p]=e:"string"==typeof s?~(i=e.indexOf(s))&&("number"==typeof a[2]?(l[p]=e.slice(0,i),e=e.slice(i+a[2])):(l[p]=e.slice(i),e=e.slice(0,i))):(i=s.exec(e))&&(l[p]=i[1],e=e.slice(0,i.index)),l[p]=l[p]||r&&a[3]&&t[p]||"",a[4]&&(l[p]=l[p].toLowerCase());o&&(l.query=o(l.query)),r&&t.slashes&&"/"!==l.pathname.charAt(0)&&(""!==l.pathname||""!==t.pathname)&&(l.pathname=function(e,t){for(var o=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=o.length,n=o[r-1],s=!1,a=0;r--;)"."===o[r]?o.splice(r,1):".."===o[r]?(o.splice(r,1),a++):a&&(0===r&&(s=!0),o.splice(r,1),a--);return s&&o.unshift(""),"."!==n&&".."!==n||o.push(""),o.join("/")}(l.pathname,t.pathname)),h(l.port,l.protocol)||(l.host=l.hostname,l.port=""),l.username=l.password="",l.auth&&(a=l.auth.split(":"),l.username=a[0]||"",l.password=a[1]||""),l.origin=l.protocol&&l.host&&"file:"!==l.protocol?l.protocol+"//"+l.host:"null",l.href=l.toString()}w.prototype={set:function(e,t,o){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(o||d.parse)(t)),r[e]=t;break;case"port":r[e]=t,h(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!o;break;case"pathname":case"hash":if(t){var n="pathname"===e?"/":"#";r[e]=t.charAt(0)!==n?n+t:t}else r[e]=t;break;default:r[e]=t}for(var s=0;s<y.length;s++){var a=y[s];a[4]&&(r[a[1]]=r[a[1]].toLowerCase())}return r.origin=r.protocol&&r.host&&"file:"!==r.protocol?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=d.stringify);var t,o=this,r=o.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var n=r+(o.slashes?"//":"");return o.username&&(n+=o.username,o.password&&(n+=":"+o.password),n+="@"),n+=o.host+o.pathname,(t="object"==typeof o.query?e(o.query):o.query)&&(n+="?"!==t.charAt(0)?"?"+t:t),o.hash&&(n+=o.hash),n}},w.extractProtocol=g,w.location=m,w.qs=d,t.exports=w}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:2,"requires-port":3}],2:[function(e,t,o){"use strict";var n=Object.prototype.hasOwnProperty;function a(e){return decodeURIComponent(e.replace(/\+/g," "))}o.stringify=function(e,t){t=t||"";var o=[];for(var r in"string"!=typeof t&&(t="?"),e)n.call(e,r)&&o.push(encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return o.length?t+o.join("&"):""},o.parse=function(e){for(var t,o=/([^=?&]+)=?([^&]*)/g,r={};t=o.exec(e);){var n=a(t[1]),s=a(t[2]);n in r||(r[n]=s)}return r}},{}],3:[function(e,t,o){"use strict";t.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},{}]},{},[1])(1)});
{
"name": "url-parse",
"version": "1.3.0",
"version": "1.4.0",
"description": "Small footprint URL parser that works seamlessly across Node.js and browser environments",

@@ -36,15 +36,15 @@ "main": "index.js",

"dependencies": {
"querystringify": "~1.0.0",
"requires-port": "~1.0.0"
"querystringify": "^2.0.0",
"requires-port": "^1.0.0"
},
"devDependencies": {
"assume": "~1.5.0",
"browserify": "~16.1.0",
"mocha": "~5.0.0",
"nyc": "~11.6.0",
"pre-commit": "~1.2.0",
"sauce-browsers": "~1.2.0",
"sauce-test": "~1.3.3",
"uglify-js": "~3.3.0"
"assume": "^2.0.1",
"browserify": "^16.2.0",
"mocha": "^5.1.1",
"nyc": "^11.7.1",
"pre-commit": "^1.2.0",
"sauce-browsers": "^1.2.0",
"sauce-test": "^1.3.3",
"uglify-js": "^3.3.21"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc