Slide 10
Slide 10 text
lo
lodashスタイルのライブラリ。たくさん機能がある
Slice操作関数。Filter,Map,Reduce,Uniq... map操作関数。FindKey,Keys,Values,Assign...
github.com/samber/lo
numbers := []int{1, 2, 3, 4}
lo.Filter(numbers, func(x int, _ int) bool {
return x%2 == 0
})
// []int{2, 4}
lo.Map(numbers, func(x int, _ int) int {
return x * 2
})
// []int{2, 4, 6, 8}
mapA := map[string]int{"foo": 10}
mapB := map[string]int{"bar": 20}
lo.FindKey(mapA, 10)
// foo, true
lo.Assign(mapA, mapB)
// map[string]int{"foo": 10, "bar": 20}