code clean in storage.js

This commit is contained in:
Ivan Socolsky 2015-02-26 12:25:17 -03:00
parent 52896dfb7f
commit fec62dfbd9
1 changed files with 3 additions and 12 deletions

View File

@ -22,7 +22,7 @@ var Storage = function(opts) {
};
var zeroPad = function(x, length) {
return (Array(length).join('0') + parseInt(x)).slice(-length);
return _.padLeft(parseInt(x), length, '0');
};
var walletPrefix = function(id) {
@ -33,7 +33,8 @@ var opKey = function(key) {
return key ? '!' + key : '';
};
var MAX_TS = Array(14).join('9');
var MAX_TS = _.repeat('9', 14);
var opKeyTs = function(key) {
return key ? '!' + zeroPad(key, 14) : '';
};
@ -106,16 +107,6 @@ Storage.prototype.fetchCopayerLookup = function(copayerId, cb) {
});
};
Storage.prototype.fetchNotification = function(walletId, notificationId, cb) {
this.db.get(KEY.NOTIFICATION(walletId, notificationId), function(err, data) {
if (err) {
if (err.notFound) return cb();
return cb(err);
}
return cb(null, Notification.fromObj(data));
});
};
Storage.prototype._completeTxData = function(walletId, txs, cb) {
var txList = [].concat(txs);
this.fetchWallet(walletId, function(err, wallet) {