Javascript aggregation