run js-beautify on everything
...with two spaces. Command: js-beautify -s 2 -r [filename]
This commit is contained in:
parent
da445e7c69
commit
ea2e2d4e19
49 changed files with 859 additions and 682 deletions
|
|
@ -111,7 +111,7 @@ Storage.prototype.get = function(walletId, k) {
|
|||
|
||||
// set value for key
|
||||
Storage.prototype.set = function(walletId, k, v, callback) {
|
||||
this.setGlobal(this._key(walletId,k), v, callback);
|
||||
this.setGlobal(this._key(walletId, k), v, callback);
|
||||
};
|
||||
|
||||
// remove value for key
|
||||
|
|
@ -143,6 +143,6 @@ Storage.prototype.getEncryptedObj = function(walletId) {
|
|||
Storage.prototype.clearAll = function(callback) {
|
||||
this.data = {};
|
||||
this.save(callback);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = require('soop')(Storage);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
var imports = require('soop').imports();
|
||||
|
||||
function Storage() {
|
||||
}
|
||||
function Storage() {}
|
||||
|
||||
Storage.prototype._read = function(k) {
|
||||
var ret;
|
||||
|
|
@ -13,7 +12,7 @@ Storage.prototype._read = function(k) {
|
|||
return ret;
|
||||
};
|
||||
|
||||
Storage.prototype._write = function(k,v) {
|
||||
Storage.prototype._write = function(k, v) {
|
||||
localStorage.setItem(k, JSON.stringify(v));
|
||||
};
|
||||
|
||||
|
|
@ -27,7 +26,7 @@ Storage.prototype._getWalletKeys = function(walletId) {
|
|||
if (walletId = split[0])
|
||||
keys.push(split[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
};
|
||||
|
|
@ -38,8 +37,8 @@ Storage.prototype.getGlobal = function(k) {
|
|||
};
|
||||
|
||||
// set value for key
|
||||
Storage.prototype.setGlobal = function(k,v) {
|
||||
this._write(k,v);
|
||||
Storage.prototype.setGlobal = function(k, v) {
|
||||
this._write(k, v);
|
||||
};
|
||||
|
||||
// remove value for key
|
||||
|
|
@ -54,44 +53,44 @@ Storage.prototype._key = function(walletId, k) {
|
|||
};
|
||||
// get value by key
|
||||
Storage.prototype.get = function(walletId, k) {
|
||||
return this.getGlobal(this._key(walletId,k));
|
||||
return this.getGlobal(this._key(walletId, k));
|
||||
};
|
||||
|
||||
// set value for key
|
||||
Storage.prototype.set = function(walletId, k,v) {
|
||||
this.setGlobal(this._key(walletId,k), v);
|
||||
Storage.prototype.set = function(walletId, k, v) {
|
||||
this.setGlobal(this._key(walletId, k), v);
|
||||
};
|
||||
|
||||
// remove value for key
|
||||
Storage.prototype.remove = function(walletId, k) {
|
||||
this.removeGlobal(this._key(walletId,k));
|
||||
this.removeGlobal(this._key(walletId, k));
|
||||
};
|
||||
|
||||
Storage.prototype.setName = function(walletId, name) {
|
||||
this.setGlobal('nameFor::'+walletId, name);
|
||||
this.setGlobal('nameFor::' + walletId, name);
|
||||
};
|
||||
|
||||
Storage.prototype.getName = function(walletId) {
|
||||
return this.getGlobal('nameFor::'+walletId);
|
||||
return this.getGlobal('nameFor::' + walletId);
|
||||
};
|
||||
|
||||
Storage.prototype.getWalletIds = function() {
|
||||
var walletIds = [];
|
||||
var uniq = {};
|
||||
for (var i = 0; i < localStorage.length; i++) {
|
||||
var key = localStorage.key(i);
|
||||
var split = key.split('::');
|
||||
if (split.length == 2) {
|
||||
var key = localStorage.key(i);
|
||||
var split = key.split('::');
|
||||
if (split.length == 2) {
|
||||
var walletId = split[0];
|
||||
|
||||
if (walletId === 'nameFor') continue;
|
||||
|
||||
if (typeof uniq[walletId] === 'undefined' ) {
|
||||
if (typeof uniq[walletId] === 'undefined') {
|
||||
walletIds.push(walletId);
|
||||
uniq[walletId] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return walletIds;
|
||||
};
|
||||
|
||||
|
|
@ -100,9 +99,9 @@ Storage.prototype.getWallets = function() {
|
|||
var uniq = {};
|
||||
var ids = this.getWalletIds();
|
||||
|
||||
for (var i in ids){
|
||||
for (var i in ids) {
|
||||
wallets.push({
|
||||
id:ids[i],
|
||||
id: ids[i],
|
||||
name: this.getName(ids[i]),
|
||||
});
|
||||
}
|
||||
|
|
@ -120,6 +119,6 @@ Storage.prototype.setFromObj = function(walletId, obj) {
|
|||
// remove all values
|
||||
Storage.prototype.clearAll = function() {
|
||||
localStorage.clear();
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = require('soop')(Storage);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue