You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now I could map to objects first sure, but arguably I could want to sum the length of an array of strings, or say the number of trues in a list of booleans like _.sum(listOfBools, (b) => b ? 1 : 0)
The text was updated successfully, but these errors were encountered:
Hey @dyerw, as Marlon said, this issue is fixed in radashi@beta (stable release coming very soon). If you'd like to know how Radashi (the fork) is different from Radash, I recently wrote a little bit about that: radashi-org/radashi#168 (comment)
I don't see any reason why in
sum
the type paramT
has to extendobject
for the non-number case:radash/src/array.ts
Line 100 in 069b26c
so long as I can provide
fn: (item: T) => number
what does it matter thatT extends object
?My specific use case is I have a normalized data object mapping ids to objects and I want to sum a list of ids like:
Now I could map to objects first sure, but arguably I could want to sum the length of an array of strings, or say the number of trues in a list of booleans like
_.sum(listOfBools, (b) => b ? 1 : 0)
The text was updated successfully, but these errors were encountered: