qs 6.9.6 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +1 -1
- package/CHANGELOG.md +10 -0
- package/README.md +8 -1
- package/dist/qs.js +1076 -5
- package/lib/parse.js +6 -0
- package/lib/stringify.js +14 -3
- package/package.json +12 -9
- package/test/parse.js +9 -0
- package/test/stringify.js +34 -1
package/.eslintrc
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"id-length": [2, { "min": 1, "max": 25, "properties": "never" }],
|
|
11
11
|
"indent": [2, 4],
|
|
12
12
|
"max-lines-per-function": [2, { "max": 150 }],
|
|
13
|
-
"max-params": [2,
|
|
13
|
+
"max-params": [2, 15],
|
|
14
14
|
"max-statements": [2, 52],
|
|
15
15
|
"multiline-comment-style": 0,
|
|
16
16
|
"no-continue": 1,
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## **6.10.0**
|
|
2
|
+
- [New] `stringify`: throw on cycles, instead of an infinite loop (#395, #394, #393)
|
|
3
|
+
- [New] `parse`: add `allowSparse` option for collapsing arrays with missing indices (#312)
|
|
4
|
+
- [meta] fix README.md (#399)
|
|
5
|
+
- [meta] only run `npm run dist` in publish, not install
|
|
6
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbols`, `tape`
|
|
7
|
+
- [Tests] fix tests on node v0.6
|
|
8
|
+
- [Tests] use `ljharb/actions/node/install` instead of `ljharb/actions/node/run`
|
|
9
|
+
- [Tests] Revert "[meta] ignore eclint transitive audit warning"
|
|
10
|
+
|
|
1
11
|
## **6.9.6**
|
|
2
12
|
- [Fix] restore `dist` dir; mistakenly removed in d4f6c32
|
|
3
13
|
|
package/README.md
CHANGED
|
@@ -227,6 +227,13 @@ var noSparse = qs.parse('a[1]=b&a[15]=c');
|
|
|
227
227
|
assert.deepEqual(noSparse, { a: ['b', 'c'] });
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
+
You may also use `allowSparse` option to parse sparse arrays:
|
|
231
|
+
|
|
232
|
+
```javascript
|
|
233
|
+
var sparseArray = qs.parse('a[1]=2&a[3]=5', { allowSparse: true });
|
|
234
|
+
assert.deepEqual(sparseArray, { a: [, '2', , '5'] });
|
|
235
|
+
```
|
|
236
|
+
|
|
230
237
|
Note that an empty string is also a value, and will be preserved:
|
|
231
238
|
|
|
232
239
|
```javascript
|
|
@@ -345,7 +352,7 @@ var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str, defaultE
|
|
|
345
352
|
The type argument is also provided to the decoder:
|
|
346
353
|
|
|
347
354
|
```javascript
|
|
348
|
-
var decoded = qs.parse('x=z', { decoder: function (str,
|
|
355
|
+
var decoded = qs.parse('x=z', { decoder: function (str, defaultDecoder, charset, type) {
|
|
349
356
|
if (type === 'key') {
|
|
350
357
|
return // Decoded key
|
|
351
358
|
} else if (type === 'value') {
|