-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
85 lines (78 loc) · 2.05 KB
/
index.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
declare const config: config.Config;
declare namespace config {
type Environments = Partial<Record<string, string>>;
interface Config {
readonly __: Utils;
readonly [x: string]: any;
}
type Parser = (
params: any,
fn: Record<string, Parser>,
vars?: Record<string, any>
) => any;
interface Utils {
/**
* Deep clone an object
*
* @param src Clone source
*/
clone(src: any): any;
/**
* Make clones of two objects then merge the second one into the first one and returns the merged object
*
* @param src Merge source
* @param tar Merge target
*/
merge(src: any, tar: any): any;
/**
* Read envs from file path
*
* @param file Env file path
* @param inject Inject envs into NODE_ENV
*/
env(file: string, inject?: boolean): Environments;
/**
* Resolve source config
*
* @param src Source config
* @param envs Env vars
*/
resolve(src: any, envs?: Environments): any;
/**
* Load config
*
* @param file Config file path
* @param envs Env vars
*/
load(file: string, envs?: Environments): any;
/**
* Clear cached config
*/
desolve(): void;
/**
* Resolve source config with custom parsers
*
* @param fn Custom parsers
* @param src Source config
* @param vars vars
*/
parse(
fn: Record<string, Parser>,
src: any,
vars?: Record<string, any>
): any;
/**
* Expand variables as in shellscript
*
* @param src Source string
* @param envs Env vars
* @param deep Enable code execution
*/
substitute(
src: string,
envs: Record<string, any>,
deep?: boolean
): string;
}
}
export = config;