1 | // Type definitions for node-config
|
2 | // Project: https://github.com/lorenwest/node-config
|
3 | // Definitions by: Roman Korneev <https://github.com/RWander>
|
4 | // Forrest Bice <https://github.com/forrestbice>
|
5 | // James Donald <https://github.com/jndonald3>
|
6 | // Alberto Vasquez <https://github.com/albertovasquez>
|
7 | // Christian Vaagland Tellnes <https://github.com/tellnes>
|
8 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
9 |
|
10 |
|
11 |
|
12 | declare var c: c.IConfig;
|
13 |
|
14 | declare namespace c {
|
15 |
|
16 | // see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities
|
17 | interface IUtil {
|
18 | // Extend an object (and any object it contains) with one or more objects (and objects contained in them).
|
19 | extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any;
|
20 |
|
21 | // Return a deep copy of the specified object.
|
22 | cloneDeep(copyFrom: any, depth?: number): any;
|
23 |
|
24 | // Return true if two objects have equal contents.
|
25 | equalsDeep(object1: any, object2: any, dept?: number): boolean;
|
26 |
|
27 | // Returns an object containing all elements that differ between two objects.
|
28 | diffDeep(object1: any, object2: any, depth?: number): any;
|
29 |
|
30 | // Make a javascript object property immutable (assuring it cannot be changed from the current value).
|
31 | makeImmutable(object: any, propertyName?: string, propertyValue?: string): any;
|
32 |
|
33 | // Make an object property hidden so it doesn't appear when enumerating elements of the object.
|
34 | makeHidden(object: any, propertyName: string, propertyValue?: string): any;
|
35 |
|
36 | // Get the current value of a config environment variable
|
37 | getEnv(varName: string): string;
|
38 |
|
39 | // Return the config for the project based on directory param if not directory then return default one (config).
|
40 | loadFileConfigs(configDir?: string): any;
|
41 |
|
42 | // Return the sources for the configurations
|
43 | getConfigSources(): IConfigSource[];
|
44 |
|
45 | // Returns a new deep copy of the current config object, or any part of the config if provided.
|
46 | toObject(config?: any): any;
|
47 |
|
48 | /**
|
49 | * This allows module developers to attach their configurations onto
|
50 | * the 6 years agoInitial 0.4 checkin default configuration object so
|
51 | * they can be configured by the consumers of the module.
|
52 | */
|
53 | setModuleDefaults(moduleName:string, defaults:any): any;
|
54 | }
|
55 |
|
56 | interface IConfig {
|
57 | get<T>(setting: string): T;
|
58 | has(setting: string): boolean;
|
59 | util: IUtil;
|
60 | }
|
61 |
|
62 | interface IConfigSource {
|
63 | name: string;
|
64 | original?: string | undefined;
|
65 | parsed: any;
|
66 | }
|
67 | }
|
68 |
|
69 | export = c;
|