diff options
Diffstat (limited to 'deps/npm/node_modules/query-string/readme.md')
-rw-r--r-- | deps/npm/node_modules/query-string/readme.md | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/deps/npm/node_modules/query-string/readme.md b/deps/npm/node_modules/query-string/readme.md index 8d2148c9d1..c9273eae00 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,10 @@ $ npm install query-string ``` +<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 @@ -133,10 +137,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 |