English
Appearance
Calculates the sum of values in an array based on a provided function.
array
import { sumBy } from 'rattail' sumBy([{ n: 1 }, { n: 2 }, { n: 3 }], ({ n }) => n) // return 6
arr
Array
fn
(val: any) => number
number