Repository: sindresorhus/query-string (js)

Issue:
Existing query params in URL get sorted even when sort is disabled for stringifyUrl
Is the following expectation correct ?

```js
test('stringify URL without sorting params', t => {
	t.deepEqual(queryString.stringifyUrl({
        url: 'https://foo.bar?C=3&A=1', query: {D: 4, B: 2}}, {sort: false}), 
             'https://foo.bar?C=3&A=1&D=4&B=2');
});
```

Currently the above test will fail because the query parameters that are already present in the URL get sorted, giving

```
'https://foo.bar?A=1&C=3&D=4&B=2'
```


Pull request:
Fix sorting existing query params in URL when `sort` option is false
Fixes #264 .

Bug is fixed by passing the `options` object received in the `stringifyUrl` function to the internal use of `parse` function. Don't know if this could have other repercussions, but all tests passed that currently pass on master.

Patch:
diff --git a/index.js b/index.js
index f8ca0df..de1d7b1 100644
--- a/index.js
+++ b/index.js
@@ -361,7 +361,7 @@ exports.stringifyUrl = (input, options) => {
 
 	const url = removeHash(input.url).split('?')[0] || '';
 	const queryFromUrl = exports.extract(input.url);
-	const parsedQueryFromUrl = exports.parse(queryFromUrl);
+	const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
 
 	const query = Object.assign(parsedQueryFromUrl, input.query);
 	let queryString = exports.stringify(query, options);


Test patch:
diff --git a/test/stringify-url.js b/test/stringify-url.js
index 98055cc..2b3c372 100644
--- a/test/stringify-url.js
+++ b/test/stringify-url.js
@@ -52,3 +52,7 @@ test('stringify URL from the result of `parseUrl` with query string that contain
 	const parsedUrl = queryString.parseUrl(url);
 	t.deepEqual(queryString.stringifyUrl(parsedUrl, {encode: false}), url);
 });
+
+test('stringify URL without sorting existing query params', t => {
+	t.deepEqual(queryString.stringifyUrl({url: 'https://foo.bar?C=3&A=1', query: {D: 4, B: 2}}, {sort: false}), 'https://foo.bar?C=3&A=1&D=4&B=2');
+});