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

Sum filter #11

Closed
avivshaked opened this issue Aug 27, 2014 · 2 comments
Closed

Sum filter #11

avivshaked opened this issue Aug 27, 2014 · 2 comments
Labels

Comments

@avivshaked
Copy link

A Sum filter would be a nice addition. I think it can be used when building tables for example.

1 Take an array as first argument.
2 If the members are Ints, sum them and return the sum.
3 If the members are Strings, parse and them sum them and return the sum.
4 If the members are objects, take a second argument that will be the path inside the object to the required param, and then perform steps 2 or 3 on the primitive values.

@a8m
Copy link
Owner

a8m commented Aug 28, 2014

Hi @avivshaked ,
I think reduce filter can be great solution.
so, we can do something like that: array | reduce: operator: initial-value[optional]

or collection | reduce: callback / expression
I just suggested, if you want to work on that. Cheers :)

@a8m a8m added the PRs plz! label Aug 28, 2014
@a8m
Copy link
Owner

a8m commented Sep 1, 2014

see: 8fd7480 e05d543

@a8m a8m closed this as completed Sep 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants