Adds example. Refactory

This commit is contained in:
Gustavo Maximiliano Cortez 2015-12-16 16:22:40 -03:00
commit 804c37bffa
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 21 additions and 3 deletions

View file

@ -24,10 +24,9 @@ angular.module('copayApp.services').factory('txFormatService', function(profileS
root.processTx = function(tx) {
if (!tx) return;
var outputs = lodash.isArray(tx.outputs) ? tx.outputs.length : 0;
if (outputs && tx.action != 'received') {
if (lodash.isArray(tx.outputs) && tx.action != 'received') {
tx.hasMultiplesOutputs = true;
tx.recipientCount = outputs;
tx.recipientCount = tx.outputs.length;
tx.amount = lodash.reduce(tx.outputs, function(total, o) {
o.amountStr = formatAmountStr(o.amount);
o.alternativeAmountStr = formatAlternativeStr(o.amount);