query-string 8.0.3 → 8.1.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.
Files changed (2) hide show
  1. package/base.js +12 -2
  2. package/package.json +3 -3
package/base.js CHANGED
@@ -353,7 +353,13 @@ export function parse(query, options) {
353
353
  continue;
354
354
  }
355
355
 
356
- let [key, value] = splitOnFirst(options.decode ? parameter.replace(/\+/g, ' ') : parameter, '=');
356
+ const parameter_ = options.decode ? parameter.replace(/\+/g, ' ') : parameter;
357
+
358
+ let [key, value] = splitOnFirst(parameter_, '=');
359
+
360
+ if (key === undefined) {
361
+ key = parameter_;
362
+ }
357
363
 
358
364
  // Missing `=` should be `null`:
359
365
  // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
@@ -454,7 +460,11 @@ export function parseUrl(url, options) {
454
460
  ...options,
455
461
  };
456
462
 
457
- const [url_, hash] = splitOnFirst(url, '#');
463
+ let [url_, hash] = splitOnFirst(url, '#');
464
+
465
+ if (url_ === undefined) {
466
+ url_ = url;
467
+ }
458
468
 
459
469
  return {
460
470
  url: url_?.split('?')?.[0] ?? '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "query-string",
3
- "version": "8.0.3",
3
+ "version": "8.1.0",
4
4
  "description": "Parse and stringify URL query strings",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/query-string",
@@ -45,9 +45,9 @@
45
45
  "filter"
46
46
  ],
47
47
  "dependencies": {
48
- "decode-uri-component": "^0.2.2",
48
+ "decode-uri-component": "^0.4.1",
49
49
  "filter-obj": "^5.1.0",
50
- "split-on-first": "^1.0.0"
50
+ "split-on-first": "^3.0.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "ava": "^5.1.0",