From 7ed940c04880b9c6237e922c94211c56ca1cc111 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 15 Aug 2017 15:02:50 +0200 Subject: [PATCH] add shortenHexData helper --- src/lib/helper.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/helper.js b/src/lib/helper.js index 4d09e04b71..5fe7cc2447 100644 --- a/src/lib/helper.js +++ b/src/lib/helper.js @@ -2,5 +2,10 @@ module.exports = { shortenAddress: function (address, etherBalance) { var len = address.length return address.slice(0, 5) + '...' + address.slice(len - 5, len) + (etherBalance ? ' (' + etherBalance.toString() + ' ether)' : '') + }, + shortenHexData: function (data) { + if (data.length < 5) return data + var len = data.length + return data.slice(0, 5) + '...' + data.slice(len - 5, len) } }