query-string 9.4.1 → 9.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base.js +11 -3
- package/package.json +2 -2
package/base.js
CHANGED
|
@@ -395,10 +395,17 @@ export function parse(query, options) {
|
|
|
395
395
|
return returnValue;
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
|
|
398
|
+
if (/^&+$/.test(query)) {
|
|
399
|
+
return returnValue;
|
|
400
|
+
}
|
|
401
|
+
|
|
399
402
|
let parameterStart = 0;
|
|
403
|
+
let firstSeparator = query.indexOf('&');
|
|
404
|
+
if (firstSeparator === -1) {
|
|
405
|
+
firstSeparator = query.length;
|
|
406
|
+
}
|
|
400
407
|
|
|
401
|
-
for (let index =
|
|
408
|
+
for (let index = firstSeparator; index <= query.length; index++) {
|
|
402
409
|
if (index < query.length && query[index] !== '&') {
|
|
403
410
|
continue;
|
|
404
411
|
}
|
|
@@ -409,7 +416,6 @@ export function parse(query, options) {
|
|
|
409
416
|
}
|
|
410
417
|
|
|
411
418
|
const parameter = query.slice(parameterStart, index);
|
|
412
|
-
parameterStart = index + 1;
|
|
413
419
|
const parameter_ = options.decode ? parameter.replaceAll('+', ' ') : parameter;
|
|
414
420
|
|
|
415
421
|
let [key, value] = splitOnFirst(parameter_, '=');
|
|
@@ -422,6 +428,8 @@ export function parse(query, options) {
|
|
|
422
428
|
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
|
423
429
|
value = value === undefined ? null : (['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options));
|
|
424
430
|
formatter(decode(key, options), value, returnValue);
|
|
431
|
+
|
|
432
|
+
parameterStart = index + 1;
|
|
425
433
|
}
|
|
426
434
|
|
|
427
435
|
for (const [key, value] of Object.entries(returnValue)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "query-string",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
4
4
|
"description": "Parse and stringify URL query strings",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/query-string",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"filter"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"decode-uri-component": "^0.
|
|
49
|
+
"decode-uri-component": "^0.5.0",
|
|
50
50
|
"filter-obj": "^5.1.0",
|
|
51
51
|
"split-on-first": "^3.0.0"
|
|
52
52
|
},
|