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

native-url

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

native-url - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

2

dist/index.js

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

var e,t=(e=require("querystring"))&&"object"==typeof e&&"default"in e?e.default:e,o=/https?|ftp|gopher|file/;function r(e){"string"==typeof e&&(e=g(e));var r=function(e,t,o){var r=e.auth,a=e.hostname,s=e.protocol||"",p=e.pathname||"",c=e.hash||"",h=e.query||"",n=!1;r=r?encodeURIComponent(r).replace(/%3A/i,":")+"@":"",e.host?n=r+e.host:a&&(n=r+(~a.indexOf(":")?"["+a+"]":a),e.port&&(n+=":"+e.port)),h&&"object"==typeof h&&(h=t.encode(h));var l=e.search||h&&"?"+h||"";return s&&":"!==s.substr(-1)&&(s+=":"),e.slashes||(!s||o.test(s))&&!1!==n?(n="//"+(n||""),p&&"/"!==p[0]&&(p="/"+p)):n||(n=""),c&&"#"!==c[0]&&(c="#"+c),l&&"?"!==l[0]&&(l="?"+l),{protocol:s,host:n,pathname:p=p.replace(/[?#]/g,encodeURIComponent),search:l=l.replace("#","%23"),hash:c}}(e,t,o);return""+r.protocol+r.host+r.pathname+r.search+r.hash}var a="http://",s="w.w",p=a+s,c=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,h=/https?|ftp|gopher|file/;function n(e,t){var o="string"==typeof e?g(e):e;e="object"==typeof e?r(e):e;var s=g(t),n="";o.protocol&&!o.slashes&&(n=o.protocol,e=e.replace(o.protocol,""),n+="/"===t[0]||"/"===e[0]?"/":""),n&&s.protocol&&(n="",s.slashes||(n=s.protocol,t=t.replace(s.protocol,"")));var l=e.match(c);l&&!s.protocol&&(e=e.substr((n=l[1]+(l[2]||"")).length),/^\/\/[^/]/.test(t)&&(n=n.slice(0,-1)));var i=new URL(e,p+"/"),f=new URL(t,i).toString().replace(p,""),u=s.protocol||o.protocol;return u+=o.slashes||s.slashes?"//":"",!n&&u?f=f.replace(a,u):n&&(f=f.replace(a,"")),h.test(f)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==f.slice(-1)||(f=f.slice(0,-1)),n&&(f=n+("/"===f[0]?f.substr(1):f)),f}function l(){}l.prototype.parse=g,l.prototype.format=r,l.prototype.resolve=n,l.prototype.resolveObject=n;var i=/^https?|ftp|gopher|file/,f=/^(.*?)([#?].*)/,u=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,m=/^([a-z0-9.+-]*:)?\/\/\/*/i,v=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function d(e){try{return decodeURI(e)}catch(t){return e}}function g(e,o,a){if(void 0===o&&(o=!1),void 0===a&&(a=!1),e&&"object"==typeof e&&e instanceof l)return e;var c=(e=e.trim()).match(f);e=c?d(c[1]).replace(/\\/g,"/")+c[2]:d(e).replace(/\\/g,"/"),v.test(e)&&"/"!==e.slice(-1)&&(e+="/");var h=!/(^javascript)/.test(e)&&e.match(u),n=m.test(e),g="";h&&(i.test(h[1])||(g=h[1].toLowerCase(),e=""+h[2]+h[3]),h[2]||(n=!1,i.test(h[1])?(g=h[1],e=""+h[3]):e="//"+h[3]),3!==h[2].length&&1!==h[2].length||(g=h[1],e="/"+h[3]));var y,b=(c?c[1]:e).match(/(:[0-9]+)/),j="";b&&b[1]&&3===b[1].length&&(e=e.replace(j=b[1],j+"00"));var w=new l,x="",U="";try{y=new URL(e)}catch(t){x=t,g||a||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(U="/",e=e.substr(1));try{y=new URL(e,p)}catch(e){return w.protocol=g,w.href=g,w}}w.slashes=n&&!U,w.host=y.host===s?"":y.host,w.hostname=y.hostname===s?"":y.hostname.replace(/(\[|\])/g,""),w.protocol=x?g||null:y.protocol,w.search=y.search.replace(/\\/g,"%5C"),w.hash=y.hash.replace(/\\/g,"%5C");var R=e.split("#");!w.search&&~R[0].indexOf("?")&&(w.search="?"),w.hash||""!==R[1]||(w.hash="#"),w.query=o?t.decode(y.search.substr(1)):w.search.substr(1),w.pathname=U+d(y.pathname).replace(/"/g,"%22"),"about:"===w.protocol&&"blank"===w.pathname&&(w.protocol="",w.pathname=""),x&&"/"!==e[0]&&(w.pathname=w.pathname.substr(1)),g&&!i.test(g)&&"/"!==e.slice(-1)&&"/"===w.pathname&&(w.pathname=""),w.path=w.pathname+w.search,w.auth=[y.username,y.password].map(decodeURIComponent).filter(Boolean).join(":"),w.port=y.port,j&&(w.host=w.host.replace(j+"00",j),w.port=w.port.slice(0,-2)),w.href=U?""+w.pathname+w.search+w.hash:r(w);var O=/^(file)/.test(w.href)?["host","hostname"]:[];return Object.keys(w).forEach(function(e){~O.indexOf(e)||(w[e]=w[e]||null)}),w}exports.parse=g,exports.format=r,exports.resolve=n,exports.resolveObject=function(e,t){return g(n(e,t))},exports.Url=l;
var e,t=(e=require("querystring"))&&"object"==typeof e&&"default"in e?e.default:e,o=/https?|ftp|gopher|file/;function r(e){"string"==typeof e&&(e=d(e));var r=function(e,t,o){var r=e.auth,a=e.hostname,s=e.protocol||"",p=e.pathname||"",h=e.hash||"",c=e.query||"",n=!1;r=r?encodeURIComponent(r).replace(/%3A/i,":")+"@":"",e.host?n=r+e.host:a&&(n=r+(~a.indexOf(":")?"["+a+"]":a),e.port&&(n+=":"+e.port)),c&&"object"==typeof c&&(c=t.encode(c));var l=e.search||c&&"?"+c||"";return s&&":"!==s.substr(-1)&&(s+=":"),e.slashes||(!s||o.test(s))&&!1!==n?(n="//"+(n||""),p&&"/"!==p[0]&&(p="/"+p)):n||(n=""),h&&"#"!==h[0]&&(h="#"+h),l&&"?"!==l[0]&&(l="?"+l),{protocol:s,host:n,pathname:p=p.replace(/[?#]/g,encodeURIComponent),search:l=l.replace("#","%23"),hash:h}}(e,t,o);return""+r.protocol+r.host+r.pathname+r.search+r.hash}var a="http://",s="w.w",p=a+s,h=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,c=/https?|ftp|gopher|file/;function n(e,t){var o="string"==typeof e?d(e):e;e="object"==typeof e?r(e):e;var s=d(t),n="";o.protocol&&!o.slashes&&(n=o.protocol,e=e.replace(o.protocol,""),n+="/"===t[0]||"/"===e[0]?"/":""),n&&s.protocol&&(n="",s.slashes||(n=s.protocol,t=t.replace(s.protocol,"")));var l=e.match(h);l&&!s.protocol&&(e=e.substr((n=l[1]+(l[2]||"")).length),/^\/\/[^/]/.test(t)&&(n=n.slice(0,-1)));var i=new URL(e,p+"/"),u=new URL(t,i).toString().replace(p,""),f=s.protocol||o.protocol;return f+=o.slashes||s.slashes?"//":"",!n&&f?u=u.replace(a,f):n&&(u=u.replace(a,"")),c.test(u)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==u.slice(-1)||(u=u.slice(0,-1)),n&&(u=n+("/"===u[0]?u.substr(1):u)),u}function l(){}l.prototype.parse=d,l.prototype.format=r,l.prototype.resolve=n,l.prototype.resolveObject=n;var i=/^https?|ftp|gopher|file/,u=/^(.*?)([#?].*)/,f=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,m=/^([a-z0-9.+-]*:)?\/\/\/*/i,v=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function d(e,o,a){if(void 0===o&&(o=!1),void 0===a&&(a=!1),e&&"object"==typeof e&&e instanceof l)return e;var h=(e=e.trim()).match(u);e=h?h[1].replace(/\\/g,"/")+h[2]:e.replace(/\\/g,"/"),v.test(e)&&"/"!==e.slice(-1)&&(e+="/");var c=!/(^javascript)/.test(e)&&e.match(f),n=m.test(e),d="";c&&(i.test(c[1])||(d=c[1].toLowerCase(),e=""+c[2]+c[3]),c[2]||(n=!1,i.test(c[1])?(d=c[1],e=""+c[3]):e="//"+c[3]),3!==c[2].length&&1!==c[2].length||(d=c[1],e="/"+c[3]));var g,y=(h?h[1]:e).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),b=y&&y[1],j=new l,w="",x="";try{g=new URL(e)}catch(t){w=t,d||a||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(x="/",e=e.substr(1));try{g=new URL(e,p)}catch(e){return j.protocol=d,j.href=d,j}}j.slashes=n&&!x,j.host=g.host===s?"":g.host,j.hostname=g.hostname===s?"":g.hostname.replace(/(\[|\])/g,""),j.protocol=w?d||null:g.protocol,j.search=g.search.replace(/\\/g,"%5C"),j.hash=g.hash.replace(/\\/g,"%5C");var U=e.split("#");!j.search&&~U[0].indexOf("?")&&(j.search="?"),j.hash||""!==U[1]||(j.hash="#"),j.query=o?t.decode(g.search.substr(1)):j.search.substr(1),j.pathname=x+function(e){return e.replace(/((?:%[0-9A-F]{2})+)/g,function(e,t){try{var o=decodeURI(t);return'"%'.includes(o)?t:o}catch(e){return t}})}(g.pathname),"about:"===j.protocol&&"blank"===j.pathname&&(j.protocol="",j.pathname=""),w&&"/"!==e[0]&&(j.pathname=j.pathname.substr(1)),d&&!i.test(d)&&"/"!==e.slice(-1)&&"/"===j.pathname&&(j.pathname=""),j.path=j.pathname+j.search,j.auth=[g.username,g.password].map(decodeURIComponent).filter(Boolean).join(":"),j.port=g.port,b&&!j.host.endsWith(b)&&(j.host+=b,j.port=b.slice(1)),j.href=x?""+j.pathname+j.search+j.hash:r(j);var R=/^(file)/.test(j.href)?["host","hostname"]:[];return Object.keys(j).forEach(function(e){~R.indexOf(e)||(j[e]=j[e]||null)}),j}exports.parse=d,exports.format=r,exports.resolve=n,exports.resolveObject=function(e,t){return d(n(e,t))},exports.Url=l;
//# sourceMappingURL=index.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("querystring")):"function"==typeof define&&define.amd?define(["exports","querystring"],t):t(e.nativeUrl={},e.querystring)}(this,function(e,t){t=t&&t.hasOwnProperty("default")?t.default:t;var o=/https?|ftp|gopher|file/;function r(e){"string"==typeof e&&(e=y(e));var r=function(e,t,o){var r=e.auth,a=e.hostname,s=e.protocol||"",n=e.pathname||"",p=e.hash||"",c=e.query||"",h=!1;r=r?encodeURIComponent(r).replace(/%3A/i,":")+"@":"",e.host?h=r+e.host:a&&(h=r+(~a.indexOf(":")?"["+a+"]":a),e.port&&(h+=":"+e.port)),c&&"object"==typeof c&&(c=t.encode(c));var l=e.search||c&&"?"+c||"";return s&&":"!==s.substr(-1)&&(s+=":"),e.slashes||(!s||o.test(s))&&!1!==h?(h="//"+(h||""),n&&"/"!==n[0]&&(n="/"+n)):h||(h=""),p&&"#"!==p[0]&&(p="#"+p),l&&"?"!==l[0]&&(l="?"+l),{protocol:s,host:h,pathname:n=n.replace(/[?#]/g,encodeURIComponent),search:l=l.replace("#","%23"),hash:p}}(e,t,o);return""+r.protocol+r.host+r.pathname+r.search+r.hash}var a="http://",s="w.w",n=a+s,p=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,c=/https?|ftp|gopher|file/;function h(e,t){var o="string"==typeof e?y(e):e;e="object"==typeof e?r(e):e;var s=y(t),h="";o.protocol&&!o.slashes&&(h=o.protocol,e=e.replace(o.protocol,""),h+="/"===t[0]||"/"===e[0]?"/":""),h&&s.protocol&&(h="",s.slashes||(h=s.protocol,t=t.replace(s.protocol,"")));var l=e.match(p);l&&!s.protocol&&(e=e.substr((h=l[1]+(l[2]||"")).length),/^\/\/[^/]/.test(t)&&(h=h.slice(0,-1)));var i=new URL(e,n+"/"),f=new URL(t,i).toString().replace(n,""),u=s.protocol||o.protocol;return u+=o.slashes||s.slashes?"//":"",!h&&u?f=f.replace(a,u):h&&(f=f.replace(a,"")),c.test(f)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==f.slice(-1)||(f=f.slice(0,-1)),h&&(f=h+("/"===f[0]?f.substr(1):f)),f}function l(){}l.prototype.parse=y,l.prototype.format=r,l.prototype.resolve=h,l.prototype.resolveObject=h;var i=/^https?|ftp|gopher|file/,f=/^(.*?)([#?].*)/,u=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,m=/^([a-z0-9.+-]*:)?\/\/\/*/i,d=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function v(e){try{return decodeURI(e)}catch(t){return e}}function y(e,o,a){if(void 0===o&&(o=!1),void 0===a&&(a=!1),e&&"object"==typeof e&&e instanceof l)return e;var p=(e=e.trim()).match(f);e=p?v(p[1]).replace(/\\/g,"/")+p[2]:v(e).replace(/\\/g,"/"),d.test(e)&&"/"!==e.slice(-1)&&(e+="/");var c=!/(^javascript)/.test(e)&&e.match(u),h=m.test(e),y="";c&&(i.test(c[1])||(y=c[1].toLowerCase(),e=""+c[2]+c[3]),c[2]||(h=!1,i.test(c[1])?(y=c[1],e=""+c[3]):e="//"+c[3]),3!==c[2].length&&1!==c[2].length||(y=c[1],e="/"+c[3]));var g,b=(p?p[1]:e).match(/(:[0-9]+)/),w="";b&&b[1]&&3===b[1].length&&(e=e.replace(w=b[1],w+"00"));var U=new l,j="",O="";try{g=new URL(e)}catch(t){j=t,y||a||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(O="/",e=e.substr(1));try{g=new URL(e,n)}catch(e){return U.protocol=y,U.href=y,U}}U.slashes=h&&!O,U.host=g.host===s?"":g.host,U.hostname=g.hostname===s?"":g.hostname.replace(/(\[|\])/g,""),U.protocol=j?y||null:g.protocol,U.search=g.search.replace(/\\/g,"%5C"),U.hash=g.hash.replace(/\\/g,"%5C");var R=e.split("#");!U.search&&~R[0].indexOf("?")&&(U.search="?"),U.hash||""!==R[1]||(U.hash="#"),U.query=o?t.decode(g.search.substr(1)):U.search.substr(1),U.pathname=O+v(g.pathname).replace(/"/g,"%22"),"about:"===U.protocol&&"blank"===U.pathname&&(U.protocol="",U.pathname=""),j&&"/"!==e[0]&&(U.pathname=U.pathname.substr(1)),y&&!i.test(y)&&"/"!==e.slice(-1)&&"/"===U.pathname&&(U.pathname=""),U.path=U.pathname+U.search,U.auth=[g.username,g.password].map(decodeURIComponent).filter(Boolean).join(":"),U.port=g.port,w&&(U.host=U.host.replace(w+"00",w),U.port=U.port.slice(0,-2)),U.href=O?""+U.pathname+U.search+U.hash:r(U);var x=/^(file)/.test(U.href)?["host","hostname"]:[];return Object.keys(U).forEach(function(e){~x.indexOf(e)||(U[e]=U[e]||null)}),U}e.parse=y,e.format=r,e.resolve=h,e.resolveObject=function(e,t){return y(h(e,t))},e.Url=l});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("querystring")):"function"==typeof define&&define.amd?define(["exports","querystring"],t):t(e.nativeUrl={},e.querystring)}(this,function(e,t){t=t&&t.hasOwnProperty("default")?t.default:t;var o=/https?|ftp|gopher|file/;function r(e){"string"==typeof e&&(e=v(e));var r=function(e,t,o){var r=e.auth,a=e.hostname,s=e.protocol||"",n=e.pathname||"",p=e.hash||"",c=e.query||"",h=!1;r=r?encodeURIComponent(r).replace(/%3A/i,":")+"@":"",e.host?h=r+e.host:a&&(h=r+(~a.indexOf(":")?"["+a+"]":a),e.port&&(h+=":"+e.port)),c&&"object"==typeof c&&(c=t.encode(c));var l=e.search||c&&"?"+c||"";return s&&":"!==s.substr(-1)&&(s+=":"),e.slashes||(!s||o.test(s))&&!1!==h?(h="//"+(h||""),n&&"/"!==n[0]&&(n="/"+n)):h||(h=""),p&&"#"!==p[0]&&(p="#"+p),l&&"?"!==l[0]&&(l="?"+l),{protocol:s,host:h,pathname:n=n.replace(/[?#]/g,encodeURIComponent),search:l=l.replace("#","%23"),hash:p}}(e,t,o);return""+r.protocol+r.host+r.pathname+r.search+r.hash}var a="http://",s="w.w",n=a+s,p=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,c=/https?|ftp|gopher|file/;function h(e,t){var o="string"==typeof e?v(e):e;e="object"==typeof e?r(e):e;var s=v(t),h="";o.protocol&&!o.slashes&&(h=o.protocol,e=e.replace(o.protocol,""),h+="/"===t[0]||"/"===e[0]?"/":""),h&&s.protocol&&(h="",s.slashes||(h=s.protocol,t=t.replace(s.protocol,"")));var l=e.match(p);l&&!s.protocol&&(e=e.substr((h=l[1]+(l[2]||"")).length),/^\/\/[^/]/.test(t)&&(h=h.slice(0,-1)));var i=new URL(e,n+"/"),f=new URL(t,i).toString().replace(n,""),u=s.protocol||o.protocol;return u+=o.slashes||s.slashes?"//":"",!h&&u?f=f.replace(a,u):h&&(f=f.replace(a,"")),c.test(f)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==f.slice(-1)||(f=f.slice(0,-1)),h&&(f=h+("/"===f[0]?f.substr(1):f)),f}function l(){}l.prototype.parse=v,l.prototype.format=r,l.prototype.resolve=h,l.prototype.resolveObject=h;var i=/^https?|ftp|gopher|file/,f=/^(.*?)([#?].*)/,u=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,m=/^([a-z0-9.+-]*:)?\/\/\/*/i,d=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function v(e,o,a){if(void 0===o&&(o=!1),void 0===a&&(a=!1),e&&"object"==typeof e&&e instanceof l)return e;var p=(e=e.trim()).match(f);e=p?p[1].replace(/\\/g,"/")+p[2]:e.replace(/\\/g,"/"),d.test(e)&&"/"!==e.slice(-1)&&(e+="/");var c=!/(^javascript)/.test(e)&&e.match(u),h=m.test(e),v="";c&&(i.test(c[1])||(v=c[1].toLowerCase(),e=""+c[2]+c[3]),c[2]||(h=!1,i.test(c[1])?(v=c[1],e=""+c[3]):e="//"+c[3]),3!==c[2].length&&1!==c[2].length||(v=c[1],e="/"+c[3]));var y,g=(p?p[1]:e).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),b=g&&g[1],w=new l,U="",j="";try{y=new URL(e)}catch(t){U=t,v||a||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(j="/",e=e.substr(1));try{y=new URL(e,n)}catch(e){return w.protocol=v,w.href=v,w}}w.slashes=h&&!j,w.host=y.host===s?"":y.host,w.hostname=y.hostname===s?"":y.hostname.replace(/(\[|\])/g,""),w.protocol=U?v||null:y.protocol,w.search=y.search.replace(/\\/g,"%5C"),w.hash=y.hash.replace(/\\/g,"%5C");var O=e.split("#");!w.search&&~O[0].indexOf("?")&&(w.search="?"),w.hash||""!==O[1]||(w.hash="#"),w.query=o?t.decode(y.search.substr(1)):w.search.substr(1),w.pathname=j+function(e){return e.replace(/((?:%[0-9A-F]{2})+)/g,function(e,t){try{var o=decodeURI(t);return'"%'.includes(o)?t:o}catch(e){return t}})}(y.pathname),"about:"===w.protocol&&"blank"===w.pathname&&(w.protocol="",w.pathname=""),U&&"/"!==e[0]&&(w.pathname=w.pathname.substr(1)),v&&!i.test(v)&&"/"!==e.slice(-1)&&"/"===w.pathname&&(w.pathname=""),w.path=w.pathname+w.search,w.auth=[y.username,y.password].map(decodeURIComponent).filter(Boolean).join(":"),w.port=y.port,b&&!w.host.endsWith(b)&&(w.host+=b,w.port=b.slice(1)),w.href=j?""+w.pathname+w.search+w.hash:r(w);var R=/^(file)/.test(w.href)?["host","hostname"]:[];return Object.keys(w).forEach(function(e){~R.indexOf(e)||(w[e]=w[e]||null)}),w}e.parse=v,e.format=r,e.resolve=h,e.resolveObject=function(e,t){return v(h(e,t))},e.Url=l});
//# sourceMappingURL=index.umd.js.map
{
"name": "native-url",
"version": "0.3.2",
"version": "0.3.3",
"description": "Brings the node url api layer to whatwg-url class",

@@ -5,0 +5,0 @@ "source": "src/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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