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

neoqs

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neoqs - npm Package Compare versions

Comparing version 6.12.7 to 6.13.0

1

dist/index.d.ts

@@ -38,2 +38,3 @@ type Format = 'RFC1738' | 'RFC3986';

parameterLimit?: number;
strictDepth?: boolean;
strictNullHandling?: boolean;

@@ -40,0 +41,0 @@ ignoreQueryPrefix?: boolean;

@@ -221,2 +221,3 @@ // src/formats.ts

plainObjects: false,
strictDepth: false,
strictNullHandling: false

@@ -345,2 +346,7 @@ };

if (segment) {
if (options.strictDepth) {
throw new RangeError(
"Input depth exceeded depth option of " + options.depth + " and strictDepth is true"
);
}
keys.push("[" + key.slice(segment.index) + "]");

@@ -392,2 +398,3 @@ }

plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth,
strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling

@@ -394,0 +401,0 @@ };

@@ -38,2 +38,3 @@ type Format = 'RFC1738' | 'RFC3986';

parameterLimit?: number;
strictDepth?: boolean;
strictNullHandling?: boolean;

@@ -40,0 +41,0 @@ ignoreQueryPrefix?: boolean;

2

dist/min/index.js

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

var e="RFC3986",t={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},o="RFC1738",r=Object.prototype.hasOwnProperty,n=Array.isArray,l=(()=>{const e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();function i(e,t,o={}){if(!t)return e;if("object"!=typeof t){if(n(e))e.push(t);else{if(!e||"object"!=typeof e)return[e,t];(o&&(o.plainObjects||o.allowPrototypes)||!r.call(Object.prototype,t))&&(e[t]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(t);let l=e;return n(e)&&!n(t)&&(l=function(e,t){const o=t&&t.plainObjects?Object.create(null):{};for(let t=0;t<e.length;++t)void 0!==e[t]&&(o[t]=e[t]);return o}(e,o)),n(e)&&n(t)?(t.forEach((function(t,n){if(r.call(e,n)){const r=e[n];r&&"object"==typeof r&&t&&"object"==typeof t?e[n]=i(r,t,o):e.push(t)}else e[n]=t})),e):Object.keys(t).reduce((function(e,n){const l=t[n];return r.call(e,n)?e[n]=i(e[n],l,o):e[n]=l,e}),l)}var a=1024;function c(e){const t=[{obj:{o:e},prop:"o"}],o=[];for(let e=0;e<t.length;++e){const r=t[e],n=r.obj[r.prop],l=Object.keys(n);for(let e=0;e<l.length;++e){const r=l[e],i=n[r];"object"==typeof i&&null!==i&&-1===o.indexOf(i)&&(t.push({obj:n,prop:r}),o.push(i))}}return function(e){for(;e.length>1;){const t=e.pop();if(!t)continue;const o=t.obj[t.prop];if(n(o)){const e=[];for(let t=0;t<o.length;++t)void 0!==o[t]&&e.push(o[t]);t.obj[t.prop]=e}}}(t),e}function s(e,t){if(n(e)){const o=[];for(let r=0;r<e.length;r+=1)o.push(t(e[r]));return o}return t(e)}var p=Object.prototype.hasOwnProperty,f=Array.isArray,u={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:function(e,t,o){const r=e.replace(/\+/g," ");if("iso-8859-1"===o)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(e){return r}},delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1};function d(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))}function y(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e}var m="utf8=%26%2310003%3B",h="utf8=%E2%9C%93";function b(e,t,o,r){if(!e)return;const n=o.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,l=/(\[[^[\]]*])/g;let i=+o.depth>0&&/(\[[^[\]]*])/.exec(n);const a=i?n.slice(0,i.index):n,c=[];if(a){if(!o.plainObjects&&p.call(Object.prototype,a)&&!o.allowPrototypes)return;c.push(a)}let s=0;for(;+o.depth>0&&null!==(i=l.exec(n))&&s<+o.depth;){if(s+=1,!o.plainObjects&&p.call(Object.prototype,i[1].slice(1,-1))&&!o.allowPrototypes)return;c.push(i[1])}return i&&c.push("["+n.slice(i.index)+"]"),function(e,t,o,r){let n=r?t:y(t,o);for(let t=e.length-1;t>=0;--t){let r;const l=e[t];if("[]"===l&&o.parseArrays)r=o.allowEmptyArrays&&(""===n||o.strictNullHandling&&null===n)?[]:[].concat(n);else{r=o.plainObjects?Object.create(null):{};const e="["===l.charAt(0)&&"]"===l.charAt(l.length-1)?l.slice(1,-1):l,t=o.decodeDotInKeys?e.replace(/%2E/g,"."):e,i=parseInt(t,10);o.parseArrays||""!==t?!isNaN(i)&&l!==t&&String(i)===t&&i>=0&&o.parseArrays&&i<=o.arrayLimit?(r=[],r[i]=n):"__proto__"!==t&&(r[t]=n):r={0:n}}n=r}return n}(c,t,o,r)}function g(e,t={}){const o=function(e){if(!e)return u;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");const t=void 0===e.charset?u.charset:e.charset,o=void 0===e.duplicates?u.duplicates:e.duplicates;if("combine"!==o&&"first"!==o&&"last"!==o)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||u.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:u.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:u.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:u.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:u.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:u.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:u.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:u.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:u.decoder,delimiter:"string"==typeof e.delimiter||(r=e.delimiter,"[object RegExp]"===Object.prototype.toString.call(r))?e.delimiter:u.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:u.depth,duplicates:o,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:u.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:u.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:u.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:u.strictNullHandling};var r}(t);if(""===e||null==e)return o.plainObjects?Object.create(null):{};const r="string"==typeof e?function(e,t){const o={__proto__:null};let r=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;r=r.replace(/%5B/gi,"[").replace(/%5D/gi,"]");const n=t.parameterLimit===1/0?void 0:t.parameterLimit,l=r.split(t.delimiter,n);let i,a=-1,c=t.charset;if(t.charsetSentinel)for(i=0;i<l.length;++i)0===l[i].indexOf("utf8=")&&(l[i]===h?c="utf-8":l[i]===m&&(c="iso-8859-1"),a=i,i=l.length);for(i=0;i<l.length;++i){if(i===a)continue;const e=l[i],r=e.indexOf("]="),n=-1===r?e.indexOf("="):r+1;let m,h;-1===n?(m=t.decoder(e,u.decoder,c,"key"),h=t.strictNullHandling?null:""):(m=t.decoder(e.slice(0,n),u.decoder,c,"key"),h=s(y(e.slice(n+1),t),(function(e){return t.decoder(e,u.decoder,c,"value")}))),h&&t.interpretNumericEntities&&"iso-8859-1"===c&&(h=d(h)),e.indexOf("[]=")>-1&&(h=f(h)?[h]:h);const g=p.call(o,m);g&&"combine"===t.duplicates?o[m]=(b=o[m],[].concat(b,h)):g&&"last"!==t.duplicates||(o[m]=h)}var b;return o}(e,o):e;let n=o.plainObjects?Object.create(null):{};const l=Object.keys(r);for(let t=0;t<l.length;++t){const a=l[t];n=i(n,b(a,r[a],o,"string"==typeof e),o)}return!0===o.allowSparse?n:c(n)}var w=Object.prototype.hasOwnProperty,j={brackets:e=>String(e)+"[]",comma:"comma",indices:(e,t)=>String(e)+"["+t+"]",repeat:e=>String(e)},v=Array.isArray,E=Array.prototype.push,O=function(e,t){E.apply(e,v(t)?t:[t])},D=Date.prototype.toISOString,A={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:(e,t,r,n,i)=>{if(0===e.length)return e;let c=e;if("symbol"==typeof e?c=Symbol.prototype.toString.call(e):"string"!=typeof e&&(c=String(e)),"iso-8859-1"===r)return escape(c).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));let s="";for(let e=0;e<c.length;e+=a){const t=c.length>=a?c.slice(e,e+a):c,r=[];for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);45===n||46===n||95===n||126===n||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122||i===o&&(40===n||41===n)?r[r.length]=t.charAt(e):n<128?r[r.length]=l[n]:n<2048?r[r.length]=l[192|n>>6]+l[128|63&n]:n<55296||n>=57344?r[r.length]=l[224|n>>12]+l[128|n>>6&63]+l[128|63&n]:(e+=1,n=65536+((1023&n)<<10|1023&t.charCodeAt(e)),r[r.length]=l[240|n>>18]+l[128|n>>12&63]+l[128|n>>6&63]+l[128|63&n])}s+=r.join("")}return s},encodeValuesOnly:!1,format:e,formatter:t[e],indices:!1,serializeDate:e=>D.call(e),skipNulls:!1,strictNullHandling:!1};var S={};function N(e,t,o,r,n,l,i,a,c,p,f,u,d,y,m,h,b,g){let w=e,j=g,E=0,D=!1;for(;void 0!==(j=j.get(S))&&!D;){const t=j.get(e);if(E+=1,void 0!==t){if(t===E)throw new RangeError("Cyclic object value");D=!0}void 0===j.get(S)&&(E=0)}if("function"==typeof p?w=p(t,w):w instanceof Date?w=d?.(w):"comma"===o&&v(w)&&(w=s(w,(function(e){return e instanceof Date?d?.(e):e}))),null===w){if(l)return c&&!h?c(t,A.encoder,b,"key",y):t;w=""}if("string"==typeof(I=w)||"number"==typeof I||"boolean"==typeof I||"symbol"==typeof I||"bigint"==typeof I||function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))}(w)){if(c){const e=h?t:c(t,A.encoder,b,"key",y);return[m?.(e)+"="+m?.(c(w,A.encoder,b,"value",y))]}return[m?.(t)+"="+m?.(String(w))]}var I;const x=[];if(void 0===w)return x;let P;if("comma"===o&&v(w))h&&c&&(w=s(w,c)),P=[{value:w.length>0?w.join(",")||null:void 0}];else if(v(p))P=p;else{const e=Object.keys(w);P=f?e.sort(f):e}const k=a?String(t).replace(/\./g,"%2E"):String(t),K=r&&v(w)&&1===w.length?k+"[]":k;if(n&&v(w)&&0===w.length)return K+"[]";for(let t=0;t<P.length;++t){const s=P[t],j="object"==typeof s&&void 0!==s.value?s.value:w[s];if(i&&null===j)continue;const D=u&&a?s.replace(/\./g,"%2E"):s,A=v(w)?"function"==typeof o?o(K,D):K:K+(u?"."+D:"["+D+"]");g.set(e,E);const I=new WeakMap;I.set(S,g),O(x,N(j,A,o,r,n,l,i,a,"comma"===o&&h&&v(w)?null:c,p,f,u,d,y,m,h,b,I))}return x}function I(o,r={}){let n=o;const l=function(o=A){if(void 0!==o.allowEmptyArrays&&"boolean"!=typeof o.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==o.encodeDotInKeys&&"boolean"!=typeof o.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==o.encoder&&void 0!==o.encoder&&"function"!=typeof o.encoder)throw new TypeError("Encoder has to be a function.");const r=o.charset||A.charset;if(void 0!==o.charset&&"utf-8"!==o.charset&&"iso-8859-1"!==o.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=e;if(void 0!==o.format){if(!w.call(t,o.format))throw new TypeError("Unknown format option provided.");n=o.format}const l=t[n];let i,a=A.filter;if(("function"==typeof o.filter||v(o.filter))&&(a=o.filter),i=o.arrayFormat&&o.arrayFormat in j?o.arrayFormat:"indices"in o?o.indices?"indices":"repeat":A.arrayFormat,"commaRoundTrip"in o&&"boolean"!=typeof o.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const c=void 0===o.allowDots?1==!!o.encodeDotInKeys||A.allowDots:!!o.allowDots;return{addQueryPrefix:"boolean"==typeof o.addQueryPrefix?o.addQueryPrefix:A.addQueryPrefix,allowDots:c,allowEmptyArrays:"boolean"==typeof o.allowEmptyArrays?!!o.allowEmptyArrays:A.allowEmptyArrays,arrayFormat:i,charset:r,charsetSentinel:"boolean"==typeof o.charsetSentinel?o.charsetSentinel:A.charsetSentinel,commaRoundTrip:!!o.commaRoundTrip,delimiter:void 0===o.delimiter?A.delimiter:o.delimiter,encode:"boolean"==typeof o.encode?o.encode:A.encode,encodeDotInKeys:"boolean"==typeof o.encodeDotInKeys?o.encodeDotInKeys:A.encodeDotInKeys,encoder:"function"==typeof o.encoder?o.encoder:A.encoder,encodeValuesOnly:"boolean"==typeof o.encodeValuesOnly?o.encodeValuesOnly:A.encodeValuesOnly,filter:a,format:n,formatter:l,serializeDate:"function"==typeof o.serializeDate?o.serializeDate:A.serializeDate,skipNulls:"boolean"==typeof o.skipNulls?o.skipNulls:A.skipNulls,sort:"function"==typeof o.sort?o.sort:null,strictNullHandling:"boolean"==typeof o.strictNullHandling?o.strictNullHandling:A.strictNullHandling}}(r);let i,a;"function"==typeof l.filter?(a=l.filter,n=a("",n)):v(l.filter)&&(a=l.filter,i=a);const c=[];if("object"!=typeof n||null===n)return"";const s=j[l.arrayFormat],p="comma"===s&&l.commaRoundTrip;i||(i=Object.keys(n)),l.sort&&i.sort(l.sort);const f=new WeakMap;for(let e=0;e<i.length;++e){const t=i[e];l.skipNulls&&null===n[t]||O(c,N(n[t],t,s,p,l.allowEmptyArrays,l.strictNullHandling,l.skipNulls,l.encodeDotInKeys,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,f))}const u=c.join(l.delimiter);let d=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}var x={formatters:t,RFC1738:o,RFC3986:"RFC3986",default:e};export{x as formats,g as parse,I as stringify};//# sourceMappingURL=index.js.map
var e="RFC3986",t={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},o="RFC1738",r=Object.prototype.hasOwnProperty,n=Array.isArray,l=(()=>{const e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();function i(e,t,o={}){if(!t)return e;if("object"!=typeof t){if(n(e))e.push(t);else{if(!e||"object"!=typeof e)return[e,t];(o&&(o.plainObjects||o.allowPrototypes)||!r.call(Object.prototype,t))&&(e[t]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(t);let l=e;return n(e)&&!n(t)&&(l=function(e,t){const o=t&&t.plainObjects?Object.create(null):{};for(let t=0;t<e.length;++t)void 0!==e[t]&&(o[t]=e[t]);return o}(e,o)),n(e)&&n(t)?(t.forEach((function(t,n){if(r.call(e,n)){const r=e[n];r&&"object"==typeof r&&t&&"object"==typeof t?e[n]=i(r,t,o):e.push(t)}else e[n]=t})),e):Object.keys(t).reduce((function(e,n){const l=t[n];return r.call(e,n)?e[n]=i(e[n],l,o):e[n]=l,e}),l)}var a=1024;function c(e){const t=[{obj:{o:e},prop:"o"}],o=[];for(let e=0;e<t.length;++e){const r=t[e],n=r.obj[r.prop],l=Object.keys(n);for(let e=0;e<l.length;++e){const r=l[e],i=n[r];"object"==typeof i&&null!==i&&-1===o.indexOf(i)&&(t.push({obj:n,prop:r}),o.push(i))}}return function(e){for(;e.length>1;){const t=e.pop();if(!t)continue;const o=t.obj[t.prop];if(n(o)){const e=[];for(let t=0;t<o.length;++t)void 0!==o[t]&&e.push(o[t]);t.obj[t.prop]=e}}}(t),e}function s(e,t){if(n(e)){const o=[];for(let r=0;r<e.length;r+=1)o.push(t(e[r]));return o}return t(e)}var p=Object.prototype.hasOwnProperty,f=Array.isArray,u={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:function(e,t,o){const r=e.replace(/\+/g," ");if("iso-8859-1"===o)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(e){return r}},delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1};function d(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))}function y(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e}var m="utf8=%26%2310003%3B",h="utf8=%E2%9C%93";function b(e,t,o,r){if(!e)return;const n=o.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,l=/(\[[^[\]]*])/g;let i=+o.depth>0&&/(\[[^[\]]*])/.exec(n);const a=i?n.slice(0,i.index):n,c=[];if(a){if(!o.plainObjects&&p.call(Object.prototype,a)&&!o.allowPrototypes)return;c.push(a)}let s=0;for(;+o.depth>0&&null!==(i=l.exec(n))&&s<+o.depth;){if(s+=1,!o.plainObjects&&p.call(Object.prototype,i[1].slice(1,-1))&&!o.allowPrototypes)return;c.push(i[1])}if(i){if(o.strictDepth)throw new RangeError("Input depth exceeded depth option of "+o.depth+" and strictDepth is true");c.push("["+n.slice(i.index)+"]")}return function(e,t,o,r){let n=r?t:y(t,o);for(let t=e.length-1;t>=0;--t){let r;const l=e[t];if("[]"===l&&o.parseArrays)r=o.allowEmptyArrays&&(""===n||o.strictNullHandling&&null===n)?[]:[].concat(n);else{r=o.plainObjects?Object.create(null):{};const e="["===l.charAt(0)&&"]"===l.charAt(l.length-1)?l.slice(1,-1):l,t=o.decodeDotInKeys?e.replace(/%2E/g,"."):e,i=parseInt(t,10);o.parseArrays||""!==t?!isNaN(i)&&l!==t&&String(i)===t&&i>=0&&o.parseArrays&&i<=o.arrayLimit?(r=[],r[i]=n):"__proto__"!==t&&(r[t]=n):r={0:n}}n=r}return n}(c,t,o,r)}function g(e,t={}){const o=function(e){if(!e)return u;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");const t=void 0===e.charset?u.charset:e.charset,o=void 0===e.duplicates?u.duplicates:e.duplicates;if("combine"!==o&&"first"!==o&&"last"!==o)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||u.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:u.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:u.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:u.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:u.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:u.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:u.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:u.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:u.decoder,delimiter:"string"==typeof e.delimiter||(r=e.delimiter,"[object RegExp]"===Object.prototype.toString.call(r))?e.delimiter:u.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:u.depth,duplicates:o,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:u.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:u.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:u.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:u.strictDepth,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:u.strictNullHandling};var r}(t);if(""===e||null==e)return o.plainObjects?Object.create(null):{};const r="string"==typeof e?function(e,t){const o={__proto__:null};let r=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;r=r.replace(/%5B/gi,"[").replace(/%5D/gi,"]");const n=t.parameterLimit===1/0?void 0:t.parameterLimit,l=r.split(t.delimiter,n);let i,a=-1,c=t.charset;if(t.charsetSentinel)for(i=0;i<l.length;++i)0===l[i].indexOf("utf8=")&&(l[i]===h?c="utf-8":l[i]===m&&(c="iso-8859-1"),a=i,i=l.length);for(i=0;i<l.length;++i){if(i===a)continue;const e=l[i],r=e.indexOf("]="),n=-1===r?e.indexOf("="):r+1;let m,h;-1===n?(m=t.decoder(e,u.decoder,c,"key"),h=t.strictNullHandling?null:""):(m=t.decoder(e.slice(0,n),u.decoder,c,"key"),h=s(y(e.slice(n+1),t),(function(e){return t.decoder(e,u.decoder,c,"value")}))),h&&t.interpretNumericEntities&&"iso-8859-1"===c&&(h=d(h)),e.indexOf("[]=")>-1&&(h=f(h)?[h]:h);const g=p.call(o,m);g&&"combine"===t.duplicates?o[m]=(b=o[m],[].concat(b,h)):g&&"last"!==t.duplicates||(o[m]=h)}var b;return o}(e,o):e;let n=o.plainObjects?Object.create(null):{};const l=Object.keys(r);for(let t=0;t<l.length;++t){const a=l[t];n=i(n,b(a,r[a],o,"string"==typeof e),o)}return!0===o.allowSparse?n:c(n)}var w=Object.prototype.hasOwnProperty,D={brackets:e=>String(e)+"[]",comma:"comma",indices:(e,t)=>String(e)+"["+t+"]",repeat:e=>String(e)},j=Array.isArray,E=Array.prototype.push,v=function(e,t){E.apply(e,j(t)?t:[t])},O=Date.prototype.toISOString,A={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:(e,t,r,n,i)=>{if(0===e.length)return e;let c=e;if("symbol"==typeof e?c=Symbol.prototype.toString.call(e):"string"!=typeof e&&(c=String(e)),"iso-8859-1"===r)return escape(c).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));let s="";for(let e=0;e<c.length;e+=a){const t=c.length>=a?c.slice(e,e+a):c,r=[];for(let e=0;e<t.length;++e){let n=t.charCodeAt(e);45===n||46===n||95===n||126===n||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122||i===o&&(40===n||41===n)?r[r.length]=t.charAt(e):n<128?r[r.length]=l[n]:n<2048?r[r.length]=l[192|n>>6]+l[128|63&n]:n<55296||n>=57344?r[r.length]=l[224|n>>12]+l[128|n>>6&63]+l[128|63&n]:(e+=1,n=65536+((1023&n)<<10|1023&t.charCodeAt(e)),r[r.length]=l[240|n>>18]+l[128|n>>12&63]+l[128|n>>6&63]+l[128|63&n])}s+=r.join("")}return s},encodeValuesOnly:!1,format:e,formatter:t[e],indices:!1,serializeDate:e=>O.call(e),skipNulls:!1,strictNullHandling:!1};var S={};function N(e,t,o,r,n,l,i,a,c,p,f,u,d,y,m,h,b,g){let w=e,D=g,E=0,O=!1;for(;void 0!==(D=D.get(S))&&!O;){const t=D.get(e);if(E+=1,void 0!==t){if(t===E)throw new RangeError("Cyclic object value");O=!0}void 0===D.get(S)&&(E=0)}if("function"==typeof p?w=p(t,w):w instanceof Date?w=d?.(w):"comma"===o&&j(w)&&(w=s(w,(function(e){return e instanceof Date?d?.(e):e}))),null===w){if(l)return c&&!h?c(t,A.encoder,b,"key",y):t;w=""}if("string"==typeof(I=w)||"number"==typeof I||"boolean"==typeof I||"symbol"==typeof I||"bigint"==typeof I||function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))}(w)){if(c){const e=h?t:c(t,A.encoder,b,"key",y);return[m?.(e)+"="+m?.(c(w,A.encoder,b,"value",y))]}return[m?.(t)+"="+m?.(String(w))]}var I;const x=[];if(void 0===w)return x;let P;if("comma"===o&&j(w))h&&c&&(w=s(w,c)),P=[{value:w.length>0?w.join(",")||null:void 0}];else if(j(p))P=p;else{const e=Object.keys(w);P=f?e.sort(f):e}const k=a?String(t).replace(/\./g,"%2E"):String(t),K=r&&j(w)&&1===w.length?k+"[]":k;if(n&&j(w)&&0===w.length)return K+"[]";for(let t=0;t<P.length;++t){const s=P[t],D="object"==typeof s&&void 0!==s.value?s.value:w[s];if(i&&null===D)continue;const O=u&&a?s.replace(/\./g,"%2E"):s,A=j(w)?"function"==typeof o?o(K,O):K:K+(u?"."+O:"["+O+"]");g.set(e,E);const I=new WeakMap;I.set(S,g),v(x,N(D,A,o,r,n,l,i,a,"comma"===o&&h&&j(w)?null:c,p,f,u,d,y,m,h,b,I))}return x}function I(o,r={}){let n=o;const l=function(o=A){if(void 0!==o.allowEmptyArrays&&"boolean"!=typeof o.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==o.encodeDotInKeys&&"boolean"!=typeof o.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==o.encoder&&void 0!==o.encoder&&"function"!=typeof o.encoder)throw new TypeError("Encoder has to be a function.");const r=o.charset||A.charset;if(void 0!==o.charset&&"utf-8"!==o.charset&&"iso-8859-1"!==o.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=e;if(void 0!==o.format){if(!w.call(t,o.format))throw new TypeError("Unknown format option provided.");n=o.format}const l=t[n];let i,a=A.filter;if(("function"==typeof o.filter||j(o.filter))&&(a=o.filter),i=o.arrayFormat&&o.arrayFormat in D?o.arrayFormat:"indices"in o?o.indices?"indices":"repeat":A.arrayFormat,"commaRoundTrip"in o&&"boolean"!=typeof o.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const c=void 0===o.allowDots?1==!!o.encodeDotInKeys||A.allowDots:!!o.allowDots;return{addQueryPrefix:"boolean"==typeof o.addQueryPrefix?o.addQueryPrefix:A.addQueryPrefix,allowDots:c,allowEmptyArrays:"boolean"==typeof o.allowEmptyArrays?!!o.allowEmptyArrays:A.allowEmptyArrays,arrayFormat:i,charset:r,charsetSentinel:"boolean"==typeof o.charsetSentinel?o.charsetSentinel:A.charsetSentinel,commaRoundTrip:!!o.commaRoundTrip,delimiter:void 0===o.delimiter?A.delimiter:o.delimiter,encode:"boolean"==typeof o.encode?o.encode:A.encode,encodeDotInKeys:"boolean"==typeof o.encodeDotInKeys?o.encodeDotInKeys:A.encodeDotInKeys,encoder:"function"==typeof o.encoder?o.encoder:A.encoder,encodeValuesOnly:"boolean"==typeof o.encodeValuesOnly?o.encodeValuesOnly:A.encodeValuesOnly,filter:a,format:n,formatter:l,serializeDate:"function"==typeof o.serializeDate?o.serializeDate:A.serializeDate,skipNulls:"boolean"==typeof o.skipNulls?o.skipNulls:A.skipNulls,sort:"function"==typeof o.sort?o.sort:null,strictNullHandling:"boolean"==typeof o.strictNullHandling?o.strictNullHandling:A.strictNullHandling}}(r);let i,a;"function"==typeof l.filter?(a=l.filter,n=a("",n)):j(l.filter)&&(a=l.filter,i=a);const c=[];if("object"!=typeof n||null===n)return"";const s=D[l.arrayFormat],p="comma"===s&&l.commaRoundTrip;i||(i=Object.keys(n)),l.sort&&i.sort(l.sort);const f=new WeakMap;for(let e=0;e<i.length;++e){const t=i[e];l.skipNulls&&null===n[t]||v(c,N(n[t],t,s,p,l.allowEmptyArrays,l.strictNullHandling,l.skipNulls,l.encodeDotInKeys,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,f))}const u=c.join(l.delimiter);let d=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}var x={formatters:t,RFC1738:o,RFC3986:"RFC3986",default:e};export{x as formats,g as parse,I as stringify};//# sourceMappingURL=index.js.map

@@ -38,2 +38,3 @@ type Format = 'RFC1738' | 'RFC3986';

parameterLimit?: number;
strictDepth?: boolean;
strictNullHandling?: boolean;

@@ -40,0 +41,0 @@ ignoreQueryPrefix?: boolean;

@@ -311,2 +311,3 @@ "use strict";

plainObjects: false,
strictDepth: false,
strictNullHandling: false

@@ -441,2 +442,5 @@ };

if (segment) {
if (options.strictDepth) {
throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true");
}
keys.push("[" + key.slice(segment.index) + "]");

@@ -488,2 +492,3 @@ }

plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth,
strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling

@@ -490,0 +495,0 @@ };

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/PuruVJ/neoqs",
"version": "6.12.7",
"version": "6.13.0",
"type": "module",

@@ -8,0 +8,0 @@ "repository": {

@@ -217,4 +217,15 @@ # neoqs

The depth limit helps mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number.
You can configure **qs** to throw an error when parsing nested input beyond this depth using the `strictDepth` option (defaulted to false):
```js
try {
qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1, strictDepth: true });
} catch (err) {
assert(err instanceof RangeError);
assert.strictEqual(err.message, 'Input depth exceeded depth option of 1 and strictDepth is true');
}
```
The depth limit helps mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number. The strictDepth option adds a layer of protection by throwing an error when the limit is exceeded, allowing you to catch and handle such cases.
For similar reasons, by default **qs** will only parse up to 1000 parameters. This can be overridden by passing a `parameterLimit` option:

@@ -221,0 +232,0 @@

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