mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-30 02:01:46 +00:00
[qs] Add 'comma' to parse options
This commit is contained in:
Vendored
+3
-1
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user