mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Update qs definitions to include 'sort' in its stringify options
This commit is contained in:
Vendored
+3
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for qs 6.2.0
|
||||
// Project: https://github.com/hapijs/qs
|
||||
// Definitions by: Roman Korneev <https://github.com/RWander>, Leon Yu <https://github.com/leonyu>
|
||||
// Definitions by: Roman Korneev <https://github.com/RWander>, Leon Yu <https://github.com/leonyu>,
|
||||
// Belinda Teh <https://github.com/tehbelinda>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = QueryString;
|
||||
@@ -16,6 +17,7 @@ declare namespace QueryString {
|
||||
filter?: Array<string | number> | ((prefix: string, value: any) => any);
|
||||
arrayFormat?: 'indices' | 'brackets' | 'repeat';
|
||||
indices?: boolean;
|
||||
sort?: (a: any, b: any) => number;
|
||||
}
|
||||
|
||||
interface IParseOptions {
|
||||
|
||||
@@ -249,3 +249,8 @@ qs.parse('a=b&c=d', { delimiter: '&' });
|
||||
var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder });
|
||||
assert.deepEqual(obj, { a: 'こんにちは!' });
|
||||
}
|
||||
|
||||
() => {
|
||||
var sorted = qs.stringify({ a: 1, c: 3, b: 2 }, { sort: (a, b) => a.localeCompare(b) })
|
||||
assert.equal(sorted, 'a=1&b=2&c=3')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user