mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
645 B
645 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MeanBy | meanby | it/math.go#L106 | it | math |
|
|
|
70 |
Returns the mean value of the collection using the given transform function.
type Person struct {
Name string
Age int
}
people := it.Slice([]Person{
{"Alice", 25},
{"Bob", 30},
{"Charlie", 35},
})
result := it.MeanBy(people, func(p Person) int {
return p.Age
})
// 30.0