Skip to content

Allow built in aggregations to be pre-aliased #35

@tannerlinsley

Description

@tannerlinsley

It looks like there are aliasing methods available like:
https://github.com/esjewett/reductio#reductioaliasmapping
But, it looks like none of these are actually meant to override the property name of the aggregation from the get go. To produce a clean value object, you would need to go back and remove the original aggregator property name.

My idea would is something along the lines of allowing a second parameter to override the property name of the aggregation:

reductio()
  .count(true, 'myCount')
  .sum(function(d) { return +d.num; }, 'theSum')

// eg.
[{
  key: 1,
  value: {
    myCount: 5,
    theSum: 25
  }
},{
  key: 2,
  value: {
    myCount: 3,
    theSum: 45
  }
}]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions