Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow built in aggregations to be pre-aliased #35

Open
tannerlinsley opened this issue Feb 28, 2016 · 1 comment
Open

Allow built in aggregations to be pre-aliased #35

tannerlinsley opened this issue Feb 28, 2016 · 1 comment

Comments

@tannerlinsley
Copy link
Contributor

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
  }
}]
@esjewett
Copy link
Member

esjewett commented Mar 4, 2016

Forgot to comment here. Good idea - implemented for count. Need to implement for other aggregations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants