From fec62dfbd95d4255cf09319c508df9bf936a50ff Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 26 Feb 2015 12:25:17 -0300 Subject: [PATCH] code clean in storage.js --- lib/storage.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/storage.js b/lib/storage.js index 81e54ea..968300f 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -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) {