forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nconf.d.ts
106 lines (88 loc) · 3.55 KB
/
nconf.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Type definitions for nconf
// Project: https://github.com/flatiron/nconf
// Definitions by: Jeff Goddard <https://github.com/jedigo>, Jean-Martin Thibault <https://github.com/jmthibault>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/nconf.d.ts
declare module "nconf" {
export var version: number;
export var stores: any;
export var sources: any[];
export function clear(key: string, callback?: ICallbackFunction): any;
export function get (key: string, callback?: ICallbackFunction): any;
export function merge(key: string, value: any, callback?: ICallbackFunction): any;
export function set (key: string, value: any, callback?: ICallbackFunction): any;
export function reset(callback?: ICallbackFunction): any;
export function load(callback?: ICallbackFunction): any;
export function mergeSources(data: any): void;
export function loadSources(): any;
export function save(value: any, callback?: ICallbackFunction): any;
export function add(name: string, options?: IOptions): Provider;
export function argv(options?: IOptions): Provider;
export function env(options?: IOptions): Provider;
export function file(name: string, options?: IFileOptions): Provider;
export function file(options: IFileOptions): Provider;
export function use(name: string, options?: IOptions): Provider;
export function defaults(options?: IOptions): Provider;
export function init(options?: IOptions): void;
export function overrides(options?: IOptions): Provider;
export function remove(name: string): void;
export function create(name: string, options: IOptions): IStore;
export function key(...values: any[]): string;
export function path(key: any): any[];
export function loadFiles(files: any, callback?: ICallbackFunction): void;
export function loadFilesSync(files: any, callback?: ICallbackFunction): void;
export var formats: {
json: IFormat;
ini: IFormat;
};
export interface IFormat {
stringify: (obj: any, replacer: any, spacing?: any) => string;
parse: (str: string) => any;
}
export interface IOptions {
type?: string;
}
export interface IFileOptions extends IOptions {
file?: string;
dir?: string;
search?: boolean;
format?: IFormat;
json_spacing?: number;
}
export interface ICallbackFunction {
(err: Error): void;
}
export class Provider {
constructor(options: IOptions);
stores: any;
sources: any[];
clear(key: string, callback?: ICallbackFunction): any;
get (key: string, callback?: ICallbackFunction): any;
merge(key: string, value: any, callback?: ICallbackFunction): any;
set (key: string, value: any, callback?: ICallbackFunction): any;
reset(callback?: ICallbackFunction): any;
load(callback?: ICallbackFunction): any;
mergeSources(data: any): void;
loadSources(): any;
save(value: any, callback?: ICallbackFunction): any;
add(name: string, options?: IOptions): Provider;
argv(options?: IOptions): Provider;
env(options?: IOptions): Provider;
file(name: string, options?: IFileOptions): Provider;
file(options: IFileOptions): Provider;
use(name: string, options?: IOptions): Provider;
defaults(options?: IOptions): Provider;
init(options?: IOptions): void;
overrides(options?: IOptions): Provider;
remove(name: string): void;
create(name: string, options: IOptions): IStore;
}
export interface IStore {
type: string;
get (key: string): any;
set (key: string, value: any): boolean;
clear(key: string): boolean;
merge(key: string, value: any): boolean;
reset(callback?: ICallbackFunction): boolean;
}
}