UNPKG

1.42 kBTypeScriptView Raw
1export default class Configstore {
2 constructor(packageName: string, defaults?: any, options?: ConfigstoreOptions);
3
4 /**
5 * Get the path to the config file. Can be used to show the user
6 * where it is, or better, open it for them.
7 */
8 path: string;
9
10 /**
11 * Get all items as an object or replace the current config with an object.
12 */
13 all: any;
14
15 /**
16 * Get the item count
17 */
18 size: number;
19
20 /**
21 * Get an item
22 * @param key The string key to get
23 * @return The contents of the config from key $key
24 */
25 get(key: string): any;
26
27 /**
28 * Set an item
29 * @param key The string key
30 * @param val The value to set
31 */
32 set(key: string, val: any): void;
33
34 /**
35 * Set all key/value pairs declared in $values
36 * @param values The values object.
37 */
38 set(values: any): void;
39
40 /**
41 * Determines if a key is present in the config
42 * @param key The string key to test for
43 * @return True if the key is present
44 */
45 has(key: string): boolean;
46
47 /**
48 * Delete an item.
49 * @param key The key to delete
50 */
51 delete(key: string): void;
52
53 /**
54 * Clear the config.
55 * Equivalent to <code>Configstore.all = {};</code>
56 */
57 clear(): void;
58}
59
60export interface ConfigstoreOptions {
61 globalConfigPath?: boolean | undefined;
62 configPath?: string | undefined;
63}