UNPKG

1.26 kBTypeScriptView Raw
1// Type definitions for caseless 0.12
2// Project: https://github.com/mikeal/caseless
3// Definitions by: downace <https://github.com/downace>
4// Matt R. Wilson <https://github.com/mastermatt>
5// Emily Klassen <https://github.com/forivall>
6// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7// TypeScript Version: 2.2
8
9type KeyType = string;
10type ValueType = any;
11type RawDict = object;
12
13declare function caseless(dict?: RawDict): caseless.Caseless;
14
15declare namespace caseless {
16 function httpify(resp: object, headers: RawDict): Caseless;
17
18 interface Caseless {
19 set(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false;
20 set(dict: RawDict): void;
21 has(name: KeyType): KeyType | false;
22 get(name: KeyType): ValueType | undefined;
23 swap(name: KeyType): void;
24 del(name: KeyType): boolean;
25 }
26
27 interface Httpified {
28 headers: RawDict;
29 setHeader(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false;
30 setHeader(dict: RawDict): void;
31 hasHeader(name: KeyType): KeyType | false;
32 getHeader(name: KeyType): ValueType | undefined;
33 removeHeader(name: KeyType): boolean;
34 }
35}
36
37export = caseless;