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.1 to 0.3.2

2

dist/index.js

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

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