diff --git a/node_modules/query-string/index.js b/node_modules/query-string/index.js index 523c87fdfb945..6a1b3c2a30eb6 100644 --- a/node_modules/query-string/index.js +++ b/node_modules/query-string/index.js @@ -123,6 +123,7 @@ function extract(input) { if (queryStart === -1) { return ''; } + return input.slice(queryStart + 1); } @@ -171,21 +172,24 @@ exports.extract = extract; exports.parse = parse; exports.stringify = (obj, options) => { - const defaults = { + if (!obj) { + return ''; + } + + options = Object.assign({ encode: true, strict: true, arrayFormat: 'none' - }; + }, options); - options = Object.assign(defaults, options); + const formatter = encoderForArrayFormat(options); + const keys = Object.keys(obj); - if (options.sort === false) { - options.sort = () => {}; + if (options.sort !== false) { + keys.sort(options.sort); } - const formatter = encoderForArrayFormat(options); - - return obj ? Object.keys(obj).sort(options.sort).map(key => { + return keys.map(key => { const value = obj[key]; if (value === undefined) { @@ -211,10 +215,15 @@ exports.stringify = (obj, options) => { } return encode(key, options) + '=' + encode(value, options); - }).filter(x => x.length > 0).join('&') : ''; + }).filter(x => x.length > 0).join('&'); }; exports.parseUrl = (input, options) => { + const hashStart = input.indexOf('#'); + if (hashStart !== -1) { + input = input.slice(0, hashStart); + } + return { url: input.split('?')[0] || '', query: parse(extract(input), options) diff --git a/node_modules/query-string/package.json b/node_modules/query-string/package.json index d29777ef1c07b..8f9b91b4fba93 100644 --- a/node_modules/query-string/package.json +++ b/node_modules/query-string/package.json @@ -1,32 +1,28 @@ { - "_args": [ - [ - "query-string@6.1.0", - "/Users/rebecca/code/npm" - ] - ], - "_from": "query-string@6.1.0", - "_id": "query-string@6.1.0", + "_from": "query-string@6.2.0", + "_id": "query-string@6.2.0", "_inBundle": false, - "_integrity": "sha512-pNB/Gr8SA8ff8KpUFM36o/WFAlthgaThka5bV19AD9PNTH20Pwq5Zxodif2YyHwrctp6SkL4GqlOot0qR/wGaw==", + "_integrity": "sha512-5wupExkIt8RYL4h/FE+WTg3JHk62e6fFPWtAZA9J5IWK1PfTfKkMS93HBUHcFpeYi9KsY5pFbh+ldvEyaz5MyA==", "_location": "/query-string", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "query-string@6.1.0", + "raw": "query-string@6.2.0", "name": "query-string", "escapedName": "query-string", - "rawSpec": "6.1.0", + "rawSpec": "6.2.0", "saveSpec": null, - "fetchSpec": "6.1.0" + "fetchSpec": "6.2.0" }, "_requiredBy": [ + "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/query-string/-/query-string-6.1.0.tgz", - "_spec": "6.1.0", - "_where": "/Users/rebecca/code/npm", + "_resolved": "https://registry.npmjs.org/query-string/-/query-string-6.2.0.tgz", + "_shasum": "468edeb542b7e0538f9f9b1aeb26f034f19c86e1", + "_spec": "query-string@6.2.0", + "_where": "/Users/aeschright/code/cli", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -35,16 +31,18 @@ "bugs": { "url": "https://github.com/sindresorhus/query-string/issues" }, + "bundleDependencies": false, "dependencies": { "decode-uri-component": "^0.2.0", "strict-uri-encode": "^2.0.0" }, + "deprecated": false, "description": "Parse and stringify URL query strings", "devDependencies": { - "ava": "*", + "ava": "^0.25.0", "deep-equal": "^1.0.1", - "fast-check": "^1.0.1", - "xo": "*" + "fast-check": "^1.5.0", + "xo": "^0.23.0" }, "engines": { "node": ">=6" @@ -77,5 +75,5 @@ "scripts": { "test": "xo && ava" }, - "version": "6.1.0" + "version": "6.2.0" } diff --git a/node_modules/query-string/readme.md b/node_modules/query-string/readme.md index f81bd6aea2da2..5fa1cfbde4306 100644 --- a/node_modules/query-string/readme.md +++ b/node_modules/query-string/readme.md @@ -15,7 +15,7 @@ $ npm install query-string ``` -This module targets Node.js 6 or later and the latest version of Chrome, Firefox, and Safari. If you want support for older browsers, use version 5: `npm install query-string@5`. +This module targets Node.js 6 or later and the latest version of Chrome, Firefox, and Safari. If you want support for older browsers, or, [if your project is using create-react-app](https://github.com/sindresorhus/query-string/pull/148#issuecomment-399656020), use version 5: `npm install query-string@5`. diff --git a/package-lock.json b/package-lock.json index bd1044eb5e6a8..cddab05f80ee3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6415,9 +6415,9 @@ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, "query-string": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.1.0.tgz", - "integrity": "sha512-pNB/Gr8SA8ff8KpUFM36o/WFAlthgaThka5bV19AD9PNTH20Pwq5Zxodif2YyHwrctp6SkL4GqlOot0qR/wGaw==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.2.0.tgz", + "integrity": "sha512-5wupExkIt8RYL4h/FE+WTg3JHk62e6fFPWtAZA9J5IWK1PfTfKkMS93HBUHcFpeYi9KsY5pFbh+ldvEyaz5MyA==", "requires": { "decode-uri-component": "^0.2.0", "strict-uri-encode": "^2.0.0" diff --git a/package.json b/package.json index b9f15bfe1c394..793c029eead0b 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "path-is-inside": "~1.0.2", "promise-inflight": "~1.0.1", "qrcode-terminal": "^0.12.0", - "query-string": "^6.1.0", + "query-string": "^6.2.0", "qw": "~1.0.1", "read": "~1.0.7", "read-cmd-shim": "~1.0.1",