Merge pull request #34273 from dpsmith3/qs-add-comma-to-parse-options

[qs] Add 'comma' to parse options
This commit is contained in:
Benjamin Lichtman
2019-04-09 10:18:34 -07:00
committed by GitHub
3 changed files with 8 additions and 2 deletions

4
types/qs/index.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for qs 6.5.0
// Type definitions for qs 6.5
// Project: https://github.com/ljharb/qs
// Definitions by: Roman Korneev <https://github.com/RWander>
// Leon Yu <https://github.com/leonyu>
@@ -6,6 +6,7 @@
// Melvin Lee <https://github.com/zyml>
// Arturs Vonda <https://github.com/artursvonda>
// Carlos Bonetti <https://github.com/CarlosBonetti>
// Dan Smith <https://github.com/dpsmith3>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = QueryString;
@@ -30,6 +31,7 @@ declare namespace QueryString {
}
interface IParseOptions {
comma?: boolean;
delimiter?: string | RegExp;
depth?: number;
decoder?: (str: string) => any;

View File

@@ -238,6 +238,11 @@ qs.parse('a=b&c=d', { delimiter: '&' });
assert.deepEqual(parsedQueryPrefix, { a: '', b: '' });
}
() => {
var parsedCommaSeparatedArray = qs.parse('?a=b,c', { comma: true });
assert.equal(parsedCommaSeparatedArray, { a: ['b', 'c']});
}
() => {
var nullsSkipped = qs.stringify({ a: 'b', c: null }, { skipNulls: true });
assert.equal(nullsSkipped, 'a=b');

View File

@@ -7,7 +7,6 @@
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"npm-naming": false,
"eofline": false,
"export-just-namespace": false,