fknop/angular-pipes

Add default (starting) value to sum pipe

ciukstar opened this issue · 0 comments

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x ] feature request

Current behavior
No default value for sum

Expected behavior
Equivalent to [1,2,3].reduce((a,b) => a + b,0)

[1,2,3] | sum:0 -> 6
[1,2,3] | sum:1 -> 7
[] | sum:0 -> 0
[1,2,3] | sum -> 6

What is the motivation / use case for changing the behavior?
More control over sum pipe