@nethesis/phone-island
Version:
NethVoice CTI Phone Island
3 lines (2 loc) • 1.24 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});const e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,t=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];exports.parse=function(r){if(r.length>2e3)throw"URI too long";const s=r,o=r.indexOf("["),n=r.indexOf("]");-1!=o&&-1!=n&&(r=r.substring(0,o)+r.substring(o,n).replace(/:/g,";")+r.substring(n,r.length));let c=e.exec(r||""),i={},u=14;for(;u--;)i[t[u]]=c[u]||"";return-1!=o&&-1!=n&&(i.source=s,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const r=/\/{2,9}/g,s=t.replace(r,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||s.splice(0,1);"/"==t.slice(-1)&&s.splice(s.length-1,1);return s}(0,i.path),i.queryKey=function(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,s){t&&(r[t]=s)})),r}(0,i.query),i};
//# sourceMappingURL=parseuri.js.map