UNPKG

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