fknop / angular-pipes

Useful pipes for Angular
https://fknop.gitbook.io/angular-pipes/
MIT License
732 stars 157 forks source link

Add default (starting) value to sum pipe #86

Open ciukstar opened 5 years ago

ciukstar commented 5 years ago

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