pages/advent/assets/querystring.b35d81f8.js

1 line
1 KiB
JavaScript

var d={};function C(e,r){return Object.prototype.hasOwnProperty.call(e,r)}var I=function(e,r,t,a){r=r||"&",t=t||"=";var n={};if(typeof e!="string"||e.length===0)return n;var f=/\+/g;e=e.split(r);var i=1e3;a&&typeof a.maxKeys=="number"&&(i=a.maxKeys);var l=e.length;i>0&&l>i&&(l=i);for(var p=0;p<l;++p){var c=e[p].replace(f,"%20"),s=c.indexOf(t),m,g,o,y;s>=0?(m=c.substr(0,s),g=c.substr(s+1)):(m=c,g=""),o=decodeURIComponent(m),y=decodeURIComponent(g),C(n,o)?Array.isArray(n[o])?n[o].push(y):n[o]=[n[o],y]:n[o]=y}return n},u=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},R=function(e,r,t,a){return r=r||"&",t=t||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(n){var f=encodeURIComponent(u(n))+t;return Array.isArray(e[n])?e[n].map(function(i){return f+encodeURIComponent(u(i))}).join(r):f+encodeURIComponent(u(e[n]))}).join(r):a?encodeURIComponent(u(a))+t+encodeURIComponent(u(e)):""};d.decode=d.parse=I;d.encode=d.stringify=R;export{d as q};