result = _.transform(
_.groupBy(data, item => item.date),
(acc, value, key) =>
acc[key] = _.reduce(_.map(value, v => v.total), (sum, n) => sum + n, 0),
{});
{
"06.10.2017": 400000,
"10.10.2017": 100000,
"11.10.2017": 100000,
"12.10.2017": 100000
}
result = _.mapObject(
_.groupBy(data, item => item.date),
(value, key) => _.reduce(_.map(value, v => v.total), (sum, n) => sum + n, 0));
var temp = data.reduce((acc, item) =>
{
if (!acc[item.date]) acc[item.date] = [];
acc[item.date].push(item.total);
return acc;
}, {});
var result = {};
for (var prop in temp) {
if (!result[prop]) result[prop] = 0;
temp[prop].forEach(v => { result[prop] += v; });
}