+
{{vin.addr}}
{{vin.value}}
diff --git a/js/filters.js b/js/filters.js
index 044ddbdf8..e726e280b 100644
--- a/js/filters.js
+++ b/js/filters.js
@@ -2,7 +2,21 @@
angular.module('copay.filters', [])
.filter('amTimeAgo', ['amMoment', function(amMoment) {
- return function(input) {
- return amMoment.preprocessDate(input).fromNow();
- };
-}]);
\ No newline at end of file
+ return function(input) {
+ return amMoment.preprocessDate(input).fromNow();
+ };
+ }])
+ .filter('groupByAddress', function() {
+ return function(inputs) {
+ function reduce(dic, input) {
+ if(!dic[input.addr]) dic[input.addr] = 0;
+ dic[input.addr] += input.value;
+ return dic;
+ }
+
+ var dic = inputs.reduce(reduce, {});
+ return Object.keys(dic).map(function(key) {
+ return { addr: key, value: dic[key] };
+ });
+ };
+ });
\ No newline at end of file