UNPKG

2.34 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/configstore`
3
4# Summary
5This package contains type definitions for configstore (https://github.com/yeoman/configstore).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/configstore.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/configstore/index.d.ts)
10````ts
11// Type definitions for configstore 5.0
12// Project: https://github.com/yeoman/configstore
13// Definitions by: ArcticLight <https://github.com/ArcticLight>
14// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
15
16export = Configstore;
17
18declare class Configstore {
19 constructor(packageName: string, defaults?: any, options?: Configstore.ConfigstoreOptions);
20
21 /**
22 * Get the path to the config file. Can be used to show the user
23 * where it is, or better, open it for them.
24 */
25 path: string;
26
27 /**
28 * Get all items as an object or replace the current config with an object.
29 */
30 all: any;
31
32 /**
33 * Get the item count
34 */
35 size: number;
36
37 /**
38 * Get an item
39 * @param key The string key to get
40 * @return The contents of the config from key $key
41 */
42 get(key: string): any;
43
44 /**
45 * Set an item
46 * @param key The string key
47 * @param val The value to set
48 */
49 set(key: string, val: any): void;
50
51 /**
52 * Set all key/value pairs declared in $values
53 * @param values The values object.
54 */
55 set(values: any): void;
56
57 /**
58 * Determines if a key is present in the config
59 * @param key The string key to test for
60 * @return True if the key is present
61 */
62 has(key: string): boolean;
63
64 /**
65 * Delete an item.
66 * @param key The key to delete
67 */
68 delete(key: string): void;
69
70 /**
71 * Clear the config.
72 * Equivalent to <code>Configstore.all = {};</code>
73 */
74 clear(): void;
75}
76
77declare namespace Configstore {
78 interface ConfigstoreOptions {
79 globalConfigPath?: boolean | undefined;
80 configPath?: string | undefined;
81 }
82}
83
84````
85
86### Additional Details
87 * Last updated: Tue, 06 Jul 2021 18:05:59 GMT
88 * Dependencies: none
89 * Global values: none
90
91# Credits
92These definitions were written by [ArcticLight](https://github.com/ArcticLight).
93
\No newline at end of file