[qs] Add 'comma' to parse options

This commit is contained in:
Dan Smith
2019-03-27 16:23:14 +00:00
parent 4ab90531d2
commit 57109e0d40
2 changed files with 8 additions and 1 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for qs 6.5.0
// Type definitions for qs 6.5.1
// 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;
+5
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');