diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/configstore/index.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/configstore/index.js')
-rw-r--r-- | node_modules/configstore/index.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/node_modules/configstore/index.js b/node_modules/configstore/index.js index 4883613ca..fb944204b 100644 --- a/node_modules/configstore/index.js +++ b/node_modules/configstore/index.js @@ -24,6 +24,7 @@ class Configstore { this.path = path.join(configDir, pathPrefix); this.all = Object.assign({}, defaults, this.all); } + get all() { try { return JSON.parse(fs.readFileSync(this.path, 'utf8')); @@ -48,6 +49,7 @@ class Configstore { throw err; } } + set all(val) { try { // Make sure the folder exists as it could have been deleted in the meantime @@ -63,12 +65,15 @@ class Configstore { throw err; } } + get size() { return Object.keys(this.all || {}).length; } + get(key) { return dotProp.get(this.all, key); } + set(key, val) { const config = this.all; @@ -82,14 +87,17 @@ class Configstore { this.all = config; } + has(key) { return dotProp.has(this.all, key); } + delete(key) { const config = this.all; dotProp.delete(config, key); this.all = config; } + clear() { this.all = {}; } |