Repository: sindresorhus/query-string (js)

Issue:
parse with option `parseNumbers: true` cause unexpected behavior
When an incomplete param are passed like `search=` the result is unexpected.

*case*
```js
const queryString = require('query-string'); // 6.8.1
const queryObject = queryString.parse('search=', { parseNumbers: true });
console.log(queryObject);
```

*received result*
```js
{ search: 0 }
```


*expected result*
```js
{ search: '' }; // or
{ }
```


Pull request description:
Ensure empty string & spaces are parsed as string when `parseNumber: true`
fix #194 

Patch:
diff --git a/index.js b/index.js
index da459c9..35c13e1 100644
--- a/index.js
+++ b/index.js
@@ -202,7 +202,7 @@ function parse(input, options) {
 		// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
 		value = value === undefined ? null : decode(value, options);
 
-		if (options.parseNumbers && !Number.isNaN(Number(value))) {
+		if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
 			value = Number(value);
 		} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
 			value = value.toLowerCase() === 'true';


Test patch:
diff --git a/test/parse.js b/test/parse.js
index 9ae2dc6..8273b71 100644
--- a/test/parse.js
+++ b/test/parse.js
@@ -243,6 +243,7 @@ test('NaN value returns as string if option is set', t => {
 	t.deepEqual(queryString.parse('foo=null', {parseNumbers: true}), {foo: 'null'});
 	t.deepEqual(queryString.parse('foo=undefined', {parseNumbers: true}), {foo: 'undefined'});
 	t.deepEqual(queryString.parse('foo=100a&bar=100', {parseNumbers: true}), {foo: '100a', bar: 100});
+	t.deepEqual(queryString.parse('foo=   &bar=', {parseNumbers: true}), {foo: '   ', bar: ''});
 });
 
 test('boolean value returns as string by default', t => {