Skip to content

Commit

Permalink
Use new mem-fs-editor read default values
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Jan 2, 2015
1 parent f6b8025 commit c256684
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions lib/util/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ var Storage = module.exports = function Storage(name, fs, configPath) {
* @return {Object} the store content
*/
Storage.prototype._store = function () {
try {
return this.fs.readJSON(this.path)[this.name] || {};
} catch (e) {
return {};
}
return this.fs.readJSON(this.path, {})[this.name] || {};
};

/**
Expand All @@ -52,12 +48,7 @@ Storage.prototype._store = function () {
*/

Storage.prototype.save = function (val) {
var fullStore;
try {
fullStore = this.fs.readJSON(this.path);
} catch (e) {
fullStore = {};
}
var fullStore = this.fs.readJSON(this.path, {});
fullStore[this.name] = val;
this.fs.write(this.path, JSON.stringify(fullStore, null, ' '));
};
Expand Down

0 comments on commit c256684

Please sign in to comment.