qs 6.10.3 → 6.10.4

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/.editorconfig CHANGED
@@ -38,3 +38,6 @@ indent_size = off
38
38
  indent_style = off
39
39
  indent = off
40
40
  max_line_length = off
41
+
42
+ [.nycrc]
43
+ indent_style = tab
package/.eslintrc CHANGED
@@ -32,7 +32,7 @@
32
32
  "no-buffer-constructor": 0,
33
33
  "no-extend-native": 0,
34
34
  "no-throw-literal": 0,
35
- }
36
- }
37
- ]
35
+ },
36
+ },
37
+ ],
38
38
  }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## **6.10.4**
2
+ - [Fix] `stringify`: with `arrayFormat: comma`, include an explicit `[]` on a single-item array (#441)
3
+ - [meta] use `npmignore` to autogenerate an npmignore file
4
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbol`, `object-inspect`, `tape`
5
+
1
6
  ## **6.10.3**
2
7
  - [Fix] `parse`: ignore `__proto__` keys (#428)
3
8
  - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
@@ -27,6 +32,18 @@
27
32
  - [Tests] use `ljharb/actions/node/install` instead of `ljharb/actions/node/run`
28
33
  - [Tests] Revert "[meta] ignore eclint transitive audit warning"
29
34
 
35
+ ## **6.9.7**
36
+ - [Fix] `parse`: ignore `__proto__` keys (#428)
37
+ - [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424)
38
+ - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
39
+ - [readme] remove travis badge; add github actions/codecov badges; update URLs
40
+ - [Docs] add note and links for coercing primitive values (#408)
41
+ - [Tests] clean up stringify tests slightly
42
+ - [meta] fix README.md (#399)
43
+ - Revert "[meta] ignore eclint transitive audit warning"
44
+ - [actions] backport actions from main
45
+ - [Dev Deps] backport updates from main
46
+
30
47
  ## **6.9.6**
31
48
  - [Fix] restore `dist` dir; mistakenly removed in d4f6c32
32
49
 
@@ -75,6 +92,19 @@
75
92
  - [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16`
76
93
  - [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray
77
94
 
95
+ ## **6.8.3**
96
+ - [Fix] `parse`: ignore `__proto__` keys (#428)
97
+ - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
98
+ - [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424)
99
+ - [readme] remove travis badge; add github actions/codecov badges; update URLs
100
+ - [Tests] clean up stringify tests slightly
101
+ - [Docs] add note and links for coercing primitive values (#408)
102
+ - [meta] fix README.md (#399)
103
+ - [actions] backport actions from main
104
+ - [Dev Deps] backport updates from main
105
+ - [Refactor] `stringify`: reduce branching
106
+ - [meta] do not publish workflow files
107
+
78
108
  ## **6.8.2**
79
109
  - [Fix] proper comma parsing of URL-encoded commas (#361)
80
110
  - [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336)
@@ -106,6 +136,19 @@
106
136
  - [meta] add FUNDING.yml
107
137
  - [meta] Clean up license text so it’s properly detected as BSD-3-Clause
108
138
 
139
+ ## **6.7.3**
140
+ - [Fix] `parse`: ignore `__proto__` keys (#428)
141
+ - [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424)
142
+ - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
143
+ - [readme] remove travis badge; add github actions/codecov badges; update URLs
144
+ - [Docs] add note and links for coercing primitive values (#408)
145
+ - [meta] fix README.md (#399)
146
+ - [meta] do not publish workflow files
147
+ - [actions] backport actions from main
148
+ - [Dev Deps] backport updates from main
149
+ - [Tests] use `nyc` for coverage
150
+ - [Tests] clean up stringify tests slightly
151
+
109
152
  ## **6.7.2**
110
153
  - [Fix] proper comma parsing of URL-encoded commas (#361)
111
154
  - [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336)
@@ -144,6 +187,32 @@
144
187
  - [Tests] fix Buffer tests to work in node < 4.5 and node < 5.10
145
188
  - [Tests] temporarily allow coverage to fail
146
189
 
190
+ ## **6.6.1**
191
+ - [Fix] `parse`: ignore `__proto__` keys (#428)
192
+ - [Fix] fix for an impossible situation: when the formatter is called with a non-string value
193
+ - [Fix] `utils.merge`: avoid a crash with a null target and an array source
194
+ - [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source
195
+ - [Fix] correctly parse nested arrays
196
+ - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
197
+ - [Robustness] `stringify`: cache `Object.prototype.hasOwnProperty`
198
+ - [Refactor] `formats`: tiny bit of cleanup.
199
+ - [Refactor] `utils`: `isBuffer`: small tweak; add tests
200
+ - [Refactor]: `stringify`/`utils`: cache `Array.isArray`
201
+ - [Refactor] `utils`: reduce observable [[Get]]s
202
+ - [Refactor] use cached `Array.isArray`
203
+ - [Refactor] `parse`/`stringify`: make a function to normalize the options
204
+ - [readme] remove travis badge; add github actions/codecov badges; update URLs
205
+ - [Docs] Clarify the need for "arrayLimit" option
206
+ - [meta] fix README.md (#399)
207
+ - [meta] do not publish workflow files
208
+ - [meta] Clean up license text so it’s properly detected as BSD-3-Clause
209
+ - [meta] add FUNDING.yml
210
+ - [meta] Fixes typo in CHANGELOG.md
211
+ - [actions] backport actions from main
212
+ - [Tests] fix Buffer tests to work in node < 4.5 and node < 5.10
213
+ - [Tests] always use `String(x)` over `x.toString()`
214
+ - [Dev Deps] backport from main
215
+
147
216
  ## **6.6.0**
148
217
  - [New] Add support for iso-8859-1, utf8 "sentinel" and numeric entities (#268)
149
218
  - [New] move two-value combine to a `utils` function (#189)
@@ -160,6 +229,30 @@
160
229
  - [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`, `iconv-lite`, `safe-publish-latest`, `tape`
161
230
  - [Tests] up to `node` `v10.10`, `v9.11`, `v8.12`, `v6.14`, `v4.9`; pin included builds to LTS
162
231
 
232
+ ## **6.5.3**
233
+ - [Fix] `parse`: ignore `__proto__` keys (#428)
234
+ - [Fix]` `utils.merge`: avoid a crash with a null target and a truthy non-array source
235
+ - [Fix] correctly parse nested arrays
236
+ - [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279)
237
+ - [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided
238
+ - [Fix] when `parseArrays` is false, properly handle keys ending in `[]`
239
+ - [Fix] fix for an impossible situation: when the formatter is called with a non-string value
240
+ - [Fix] `utils.merge`: avoid a crash with a null target and an array source
241
+ - [Refactor] `utils`: reduce observable [[Get]]s
242
+ - [Refactor] use cached `Array.isArray`
243
+ - [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269)
244
+ - [Refactor] `parse`: only need to reassign the var once
245
+ - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
246
+ - [readme] remove travis badge; add github actions/codecov badges; update URLs
247
+ - [Docs] Clean up license text so it’s properly detected as BSD-3-Clause
248
+ - [Docs] Clarify the need for "arrayLimit" option
249
+ - [meta] fix README.md (#399)
250
+ - [meta] add FUNDING.yml
251
+ - [actions] backport actions from main
252
+ - [Tests] always use `String(x)` over `x.toString()`
253
+ - [Tests] remove nonexistent tape option
254
+ - [Dev Deps] backport from main
255
+
163
256
  ## **6.5.2**
164
257
  - [Fix] use `safer-buffer` instead of `Buffer` constructor
165
258
  - [Refactor] utils: `module.exports` one thing, instead of mutating `exports` (#230)
@@ -186,6 +279,27 @@
186
279
  - [Tests] up to `node` `v8.1`, `v7.10`, `v6.11`; npm v4.6 breaks on node < v1; npm v5+ breaks on node < v4
187
280
  - [Tests] add `editorconfig-tools`
188
281
 
282
+ ## **6.4.1**
283
+ - [Fix] `parse`: ignore `__proto__` keys (#428)
284
+ - [Fix] fix for an impossible situation: when the formatter is called with a non-string value
285
+ - [Fix] use `safer-buffer` instead of `Buffer` constructor
286
+ - [Fix] `utils.merge`: avoid a crash with a null target and an array source
287
+ - [Fix]` `utils.merge`: avoid a crash with a null target and a truthy non-array source
288
+ - [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279)
289
+ - [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided
290
+ - [Fix] when `parseArrays` is false, properly handle keys ending in `[]`
291
+ - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
292
+ - [Refactor] use cached `Array.isArray`
293
+ - [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269)
294
+ - [readme] remove travis badge; add github actions/codecov badges; update URLs
295
+ - [Docs] Clarify the need for "arrayLimit" option
296
+ - [meta] fix README.md (#399)
297
+ - [meta] Clean up license text so it’s properly detected as BSD-3-Clause
298
+ - [meta] add FUNDING.yml
299
+ - [actions] backport actions from main
300
+ - [Tests] remove nonexistent tape option
301
+ - [Dev Deps] backport from main
302
+
189
303
  ## **6.4.0**
190
304
  - [New] `qs.stringify`: add `encodeValuesOnly` option
191
305
  - [Fix] follow `allowPrototypes` option during merge (#201, #201)
@@ -195,6 +309,26 @@
195
309
  - [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds
196
310
  - [eslint] reduce warnings
197
311
 
312
+ ## **6.3.3**
313
+ - [Fix] `parse`: ignore `__proto__` keys (#428)
314
+ - [Fix] fix for an impossible situation: when the formatter is called with a non-string value
315
+ - [Fix] `utils.merge`: avoid a crash with a null target and an array source
316
+ - [Fix]` `utils.merge`: avoid a crash with a null target and a truthy non-array source
317
+ - [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279)
318
+ - [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided
319
+ - [Fix] when `parseArrays` is false, properly handle keys ending in `[]`
320
+ - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
321
+ - [Refactor] use cached `Array.isArray`
322
+ - [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269)
323
+ - [Docs] Clarify the need for "arrayLimit" option
324
+ - [meta] fix README.md (#399)
325
+ - [meta] Clean up license text so it’s properly detected as BSD-3-Clause
326
+ - [meta] add FUNDING.yml
327
+ - [actions] backport actions from main
328
+ - [Tests] use `safer-buffer` instead of `Buffer` constructor
329
+ - [Tests] remove nonexistent tape option
330
+ - [Dev Deps] backport from main
331
+
198
332
  ## **6.3.2**
199
333
  - [Fix] follow `allowPrototypes` option during merge (#201, #200)
200
334
  - [Dev Deps] update `eslint`
@@ -228,6 +362,23 @@
228
362
  - [Tests] skip Object.create tests when null objects are not available
229
363
  - [Tests] Turn on eslint for test files (#175)
230
364
 
365
+ ## **6.2.4**
366
+ - [Fix] `parse`: ignore `__proto__` keys (#428)
367
+ - [Fix] `utils.merge`: avoid a crash with a null target and an array source
368
+ - [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source
369
+ - [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided
370
+ - [Fix] when `parseArrays` is false, properly handle keys ending in `[]`
371
+ - [Robustness] `stringify`: avoid relying on a global `undefined` (#427)
372
+ - [Refactor] use cached `Array.isArray`
373
+ - [Docs] Clarify the need for "arrayLimit" option
374
+ - [meta] fix README.md (#399)
375
+ - [meta] Clean up license text so it’s properly detected as BSD-3-Clause
376
+ - [meta] add FUNDING.yml
377
+ - [actions] backport actions from main
378
+ - [Tests] use `safer-buffer` instead of `Buffer` constructor
379
+ - [Tests] remove nonexistent tape option
380
+ - [Dev Deps] backport from main
381
+
231
382
  ## **6.2.3**
232
383
  - [Fix] follow `allowPrototypes` option during merge (#201, #200)
233
384
  - [Fix] chmod a-x
package/dist/qs.js CHANGED
@@ -430,7 +430,7 @@ var stringify = function stringify(
430
430
  for (var i = 0; i < valuesArray.length; ++i) {
431
431
  valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
432
432
  }
433
- return [formatter(keyValue) + '=' + valuesJoined];
433
+ return [formatter(keyValue) + (i === 1 ? '[]' : '') + '=' + valuesJoined];
434
434
  }
435
435
  return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
436
436
  }
@@ -1469,8 +1469,9 @@ function addNumericSeparator(num, str) {
1469
1469
  return $replace.call(str, sepRegex, '$&_');
1470
1470
  }
1471
1471
 
1472
- var inspectCustom = require('./util.inspect').custom;
1473
- var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
1472
+ var utilInspect = require('./util.inspect');
1473
+ var inspectCustom = utilInspect.custom;
1474
+ var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
1474
1475
 
1475
1476
  module.exports = function inspect_(obj, options, depth, seen) {
1476
1477
  var opts = options || {};
@@ -1560,7 +1561,7 @@ module.exports = function inspect_(obj, options, depth, seen) {
1560
1561
  return inspect_(value, opts, depth + 1, seen);
1561
1562
  }
1562
1563
 
1563
- if (typeof obj === 'function') {
1564
+ if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable
1564
1565
  var name = nameOf(obj);
1565
1566
  var keys = arrObjKeys(obj, inspect);
1566
1567
  return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
@@ -1590,15 +1591,15 @@ module.exports = function inspect_(obj, options, depth, seen) {
1590
1591
  }
1591
1592
  if (isError(obj)) {
1592
1593
  var parts = arrObjKeys(obj, inspect);
1593
- if ('cause' in obj && !isEnumerable.call(obj, 'cause')) {
1594
+ if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
1594
1595
  return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
1595
1596
  }
1596
1597
  if (parts.length === 0) { return '[' + String(obj) + ']'; }
1597
1598
  return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
1598
1599
  }
1599
1600
  if (typeof obj === 'object' && customInspect) {
1600
- if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
1601
- return obj[inspectSymbol]();
1601
+ if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
1602
+ return utilInspect(obj, { depth: maxDepth - depth });
1602
1603
  } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
1603
1604
  return obj.inspect();
1604
1605
  }
package/lib/stringify.js CHANGED
@@ -126,7 +126,7 @@ var stringify = function stringify(
126
126
  for (var i = 0; i < valuesArray.length; ++i) {
127
127
  valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
128
128
  }
129
- return [formatter(keyValue) + '=' + valuesJoined];
129
+ return [formatter(keyValue) + (i === 1 ? '[]' : '') + '=' + valuesJoined];
130
130
  }
131
131
  return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
132
132
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "qs",
3
3
  "description": "A querystring parser that supports nesting and arrays, with a depth limit",
4
4
  "homepage": "https://github.com/ljharb/qs",
5
- "version": "6.10.3",
5
+ "version": "6.10.4",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/ljharb/qs.git"
@@ -33,25 +33,27 @@
33
33
  "side-channel": "^1.0.4"
34
34
  },
35
35
  "devDependencies": {
36
- "@ljharb/eslint-config": "^20.1.0",
37
- "aud": "^1.1.5",
36
+ "@ljharb/eslint-config": "^21.0.0",
37
+ "aud": "^2.0.0",
38
38
  "browserify": "^16.5.2",
39
39
  "eclint": "^2.8.1",
40
- "eslint": "^8.6.0",
40
+ "eslint": "=8.8.0",
41
41
  "evalmd": "^0.0.19",
42
42
  "for-each": "^0.3.3",
43
- "has-symbols": "^1.0.2",
43
+ "has-symbols": "^1.0.3",
44
44
  "iconv-lite": "^0.5.1",
45
45
  "in-publish": "^2.0.1",
46
46
  "mkdirp": "^0.5.5",
47
+ "npmignore": "^0.3.0",
47
48
  "nyc": "^10.3.2",
48
- "object-inspect": "^1.12.0",
49
+ "object-inspect": "^1.12.2",
49
50
  "qs-iconv": "^1.0.4",
50
51
  "safe-publish-latest": "^2.0.0",
51
52
  "safer-buffer": "^2.1.2",
52
- "tape": "^5.4.0"
53
+ "tape": "^5.5.3"
53
54
  },
54
55
  "scripts": {
56
+ "prepack": "npmignore --auto --commentLines=autogenerated",
55
57
  "prepublishOnly": "safe-publish-latest && npm run dist",
56
58
  "prepublish": "not-in-publish || npm run prepublishOnly",
57
59
  "pretest": "npm run --silent readme && npm run --silent lint",
@@ -59,15 +61,17 @@
59
61
  "tests-only": "nyc tape 'test/**/*.js'",
60
62
  "posttest": "aud --production",
61
63
  "readme": "evalmd README.md",
62
- "postlint": "eclint check * lib/* test/* !dist/*",
63
- "lint": "eslint .",
64
+ "postlint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)",
65
+ "lint": "eslint --ext=js,mjs .",
64
66
  "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js"
65
67
  },
66
68
  "license": "BSD-3-Clause",
67
- "greenkeeper": {
69
+ "publishConfig": {
68
70
  "ignore": [
69
- "iconv-lite",
70
- "mkdirp"
71
+ "!dist/*",
72
+ "bower.json",
73
+ "component.json",
74
+ ".github/workflows"
71
75
  ]
72
76
  }
73
77
  }
package/test/parse.js CHANGED
@@ -140,6 +140,9 @@ test('parse()', function (t) {
140
140
  t.test('limits specific array indices to arrayLimit', function (st) {
141
141
  st.deepEqual(qs.parse('a[20]=a', { arrayLimit: 20 }), { a: ['a'] });
142
142
  st.deepEqual(qs.parse('a[21]=a', { arrayLimit: 20 }), { a: { 21: 'a' } });
143
+
144
+ st.deepEqual(qs.parse('a[20]=a'), { a: ['a'] });
145
+ st.deepEqual(qs.parse('a[21]=a'), { a: { 21: 'a' } });
143
146
  st.end();
144
147
  });
145
148
 
@@ -378,6 +381,7 @@ test('parse()', function (t) {
378
381
  st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' });
379
382
  st.deepEqual(qs.parse('foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' });
380
383
  st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: false }), { '?foo': 'bar' });
384
+
381
385
  st.end();
382
386
  });
383
387
 
@@ -406,6 +410,16 @@ test('parse()', function (t) {
406
410
  st.deepEqual(qs.parse('foo=', { comma: true }), { foo: '' });
407
411
  st.deepEqual(qs.parse('foo', { comma: true }), { foo: '' });
408
412
  st.deepEqual(qs.parse('foo', { comma: true, strictNullHandling: true }), { foo: null });
413
+
414
+ // test cases inversed from from stringify tests
415
+ st.deepEqual(qs.parse('a[0]=c'), { a: ['c'] });
416
+ st.deepEqual(qs.parse('a[]=c'), { a: ['c'] });
417
+ st.deepEqual(qs.parse('a[]=c', { comma: true }), { a: ['c'] });
418
+
419
+ st.deepEqual(qs.parse('a[0]=c&a[1]=d'), { a: ['c', 'd'] });
420
+ st.deepEqual(qs.parse('a[]=c&a[]=d'), { a: ['c', 'd'] });
421
+ st.deepEqual(qs.parse('a=c,d', { comma: true }), { a: ['c', 'd'] });
422
+
409
423
  st.end();
410
424
  });
411
425
 
package/test/stringify.js CHANGED
@@ -131,6 +131,20 @@ test('stringify()', function (t) {
131
131
  st.end();
132
132
  });
133
133
 
134
+ t.test('stringifies an array value with one item vs multiple items', function (st) {
135
+ st.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[0]=c');
136
+ st.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[]=c');
137
+ st.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a[]=c'); // so it parses back as an array
138
+ st.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true }), 'a[0]=c');
139
+
140
+ st.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[0]=c&a[1]=d');
141
+ st.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[]=c&a[]=d');
142
+ st.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=c,d');
143
+ st.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true }), 'a[0]=c&a[1]=d');
144
+
145
+ st.end();
146
+ });
147
+
134
148
  t.test('stringifies a nested array value', function (st) {
135
149
  st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[b][0]=c&a[b][1]=d');
136
150
  st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[b][]=c&a[b][]=d');
@@ -714,16 +728,14 @@ test('stringify()', function (t) {
714
728
  });
715
729
 
716
730
  t.test('Edge cases and unknown formats', function (st) {
717
- ['UFO1234', false, 1234, null, {}, []].forEach(
718
- function (format) {
719
- st['throws'](
720
- function () {
721
- qs.stringify({ a: 'b c' }, { format: format });
722
- },
723
- new TypeError('Unknown format option provided.')
724
- );
725
- }
726
- );
731
+ ['UFO1234', false, 1234, null, {}, []].forEach(function (format) {
732
+ st['throws'](
733
+ function () {
734
+ qs.stringify({ a: 'b c' }, { format: format });
735
+ },
736
+ new TypeError('Unknown format option provided.')
737
+ );
738
+ });
727
739
  st.end();
728
740
  });
729
741