refactor key handing in storage (part 1)

This commit is contained in:
Matias Alejo Garcia 2014-09-27 11:38:25 -03:00
commit 691951a86a
3 changed files with 16 additions and 15 deletions

View file

@ -330,12 +330,10 @@ Storage.prototype.getLastOpened = function(cb) {
this.getGlobal('lastOpened', cb);
};
Storage.prototype.setFromObj = function(walletId, obj, cb) {
Storage.prototype.setFromObj = function(key, obj, cb) {
preconditions.checkArgument(key);
preconditions.checkArgument(cb);
var self = this;
var key = 'wallet::' + walletId + ((obj.opts && obj.opts.name) ? '_' + obj.opts.name : '');
self._write(key, obj, function() {
this._write(key, obj, function() {
return cb();
});
};