diff options
Diffstat (limited to 'deps/npm/node_modules/query-string/readme.md')
-rw-r--r-- | deps/npm/node_modules/query-string/readme.md | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/deps/npm/node_modules/query-string/readme.md b/deps/npm/node_modules/query-string/readme.md index 8d2148c9d1..f81bd6aea2 100644 --- a/deps/npm/node_modules/query-string/readme.md +++ b/deps/npm/node_modules/query-string/readme.md @@ -1,10 +1,10 @@ # query-string [![Build Status](https://travis-ci.org/sindresorhus/query-string.svg?branch=master)](https://travis-ci.org/sindresorhus/query-string) -> Parse and stringify URL [query strings](http://en.wikipedia.org/wiki/Query_string) +> Parse and stringify URL [query strings](https://en.wikipedia.org/wiki/Query_string) --- -<p align="center"><b>🔥 Want to strengthen your core JavaScript skills and master ES6?</b><br>I would personally recommend this awesome <a href="https://ES6.io/friend/AWESOME">ES6 course</a> by Wes Bos. You might also like his <a href="https://ReactForBeginners.com/friend/AWESOME">React course</a>.</p> +<p align="center"><b>🔥 Want to strengthen your core JavaScript skills and master ES6?</b><br>I would personally recommend this awesome <a href="https://ES6.io/friend/AWESOME">ES6 course</a> by Wes Bos.<br>Also check out his <a href="https://LearnNode.com/friend/AWESOME">Node.js</a>, <a href="https://ReactForBeginners.com/friend/AWESOME">React</a>, <a href="https://SublimeTextBook.com/friend/AWESOME">Sublime</a> courses.</p> --- @@ -15,6 +15,12 @@ $ 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`. + +<a href="https://www.patreon.com/sindresorhus"> + <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160"> +</a> + ## Usage @@ -56,7 +62,12 @@ Parse a query string into an object. Leading `?` or `#` are ignored, so you can The returned object is created with [`Object.create(null)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create) and thus does not have a `prototype`. -URI components are decoded with [`decode-uri-component`](https://github.com/SamVerschueren/decode-uri-component). +#### decode + +Type: `boolean`<br> +Default: `true` + +Decode the keys and values. URI components are decoded with [`decode-uri-component`](https://github.com/SamVerschueren/decode-uri-component). #### arrayFormat @@ -133,10 +144,44 @@ queryString.stringify({foo: [1,2,3]}); // => foo=1&foo=2&foo=3 ``` +#### sort + +Type: `Function` `boolean` + +Supports both `Function` as a custom sorting function or `false` to disable sorting. + +```js +const order = ['c', 'a', 'b']; +queryString.stringify({ a: 1, b: 2, c: 3}, { + sort: (m, n) => order.indexOf(m) >= order.indexOf(n) +}); +// => 'c=3&a=1&b=2' +``` + +```js +queryString.stringify({ b: 1, c: 2, a: 3}, {sort: false}); +// => 'c=3&a=1&b=2' +``` + +If omitted, keys are sorted using `Array#sort`, which means, converting them to strings and comparing strings in Unicode code point order. + ### .extract(*string*) Extract a query string from a URL that can be passed into `.parse()`. +### .parseUrl(*string*, *[options]*) + +Extract the URL and the query string as an object. + +The `options` are the same as for `.parse()`. + +Returns an object with a `url` and `query` property. + +```js +queryString.parseUrl('https://foo.bar?foo=bar'); +//=> {url: 'https://foo.bar', query: {foo: 'bar'}} +``` + ## Nesting |