Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 12, 2017
1 parent 0038054 commit 756b1c0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto
*.js text eol=lf
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';

var strictUriEncode = require('strict-uri-encode');
var objectAssign = require('object-assign');

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"strict-uri-encode": "^1.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
"ava": "^0.17.0",
"xo": "^0.16.0"
}
}
36 changes: 24 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
---

<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.</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. You might also like his <a href="https://ReactForBeginners.com/friend/AWESOME">React course</a>.</p>

---

Expand Down Expand Up @@ -61,21 +61,27 @@ The returned object is created with [`Object.create(null)`](https://developer.mo
Type: `string`<br>
Default: `'none'`

Supports both `index` for an indexed array representation or `bracket` for a _bracketed_ array representation.
* `bracket`: stands for parsing correctly arrays with bracket representation on the query string, such as:
Supports both `index` for an indexed array representation or `bracket` for a *bracketed* array representation.

- `bracket`: stands for parsing correctly arrays with bracket representation on the query string, such as:

```js
queryString.parse('foo[]=1&foo[]=2&foo[]=3', {arrayFormat: 'bracket'});
// => foo: [1,2,3]
//=> foo: [1,2,3]
```
* `index`: stands for parsing taking the index into account, such as:

- `index`: stands for parsing taking the index into account, such as:

```js
queryString.parse('foo[0]=1&foo[1]=2&foo[3]=3', {arrayFormat: 'index'});
// => foo: [1,2,3]
//=> foo: [1,2,3]
```
* `none`: is the __default__ option and removes any bracket representation, such as:

- `none`: is the **default** option and removes any bracket representation, such as:

```js
queryString.parse('foo=1&foo=2&foo=3');
// => foo: [1,2,3]
//=> foo: [1,2,3]
```

### .stringify(*object*, *[options]*)
Expand All @@ -102,18 +108,24 @@ Default: `true`
Type: `string`<br>
Default: `'none'`

Supports both `index` for an indexed array representation or `bracket` for a _bracketed_ array representation.
* `bracket`: stands for parsing correctly arrays with bracket representation on the query string, such as:
Supports both `index` for an indexed array representation or `bracket` for a *bracketed* array representation.

- `bracket`: stands for parsing correctly arrays with bracket representation on the query string, such as:

```js
queryString.stringify({foo: [1,2,3]}, {arrayFormat: 'bracket'});
// => foo[]=1&foo[]=2&foo[]=3
```
* `index`: stands for parsing taking the index into account, such as:

- `index`: stands for parsing taking the index into account, such as:

```js
queryString.stringify({foo: [1,2,3]}, {arrayFormat: 'index'});
// => foo[0]=1&foo[1]=2&foo[3]=3
```
* `none`: is the __default__ option and removes any bracket representation, such as:

- `none`: is the __default__ option and removes any bracket representation, such as:

```js
queryString.stringify({foo: [1,2,3]});
// => foo=1&foo=2&foo=3
Expand Down
4 changes: 2 additions & 2 deletions test/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ test('should not encode undefined values', t => {
test('should encode null values as just a key', t => {
t.is(fn.stringify({
'x y z': null,
abc: null,
foo: 'baz'
'abc': null,
'foo': 'baz'
}), 'abc&foo=baz&x%20y%20z');
});

Expand Down

0 comments on commit 756b1c0

Please sign in to comment.