refactor: small improvements and clean up (#3423)
* refactor: replace custom map functions with slice.Map * refactor: extract StringerValue function * refactor: removed unnecessary if * chore: removed invalid comment * refactor: replace more map functions * chore: fix FFmpeg typo
This commit is contained in:
@@ -15,6 +15,12 @@ func Map[T any, R any](t []T, mapFunc func(T) R) []R {
|
||||
return r
|
||||
}
|
||||
|
||||
func MapWithArg[I any, O any, A any](t []I, arg A, mapFunc func(A, I) O) []O {
|
||||
return Map(t, func(e I) O {
|
||||
return mapFunc(arg, e)
|
||||
})
|
||||
}
|
||||
|
||||
func Group[T any, K comparable](s []T, keyFunc func(T) K) map[K][]T {
|
||||
m := map[K][]T{}
|
||||
for _, item := range s {
|
||||
|
||||
Reference in New Issue
Block a user