1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

Bump generics dependency

This commit is contained in:
Stefan Haller
2025-05-17 15:38:29 +02:00
parent 1fbfefa625
commit 5686e63af3
6 changed files with 75 additions and 12 deletions

View File

@ -19,7 +19,7 @@ func Values[Key comparable, Value any](m map[Key]Value) []Value {
func TransformValues[Key comparable, Value any, NewValue any](
m map[Key]Value, fn func(Value) NewValue,
) map[Key]NewValue {
output := make(map[Key]NewValue)
output := make(map[Key]NewValue, len(m))
for key, value := range m {
output[key] = fn(value)
}
@ -27,7 +27,7 @@ func TransformValues[Key comparable, Value any, NewValue any](
}
func TransformKeys[Key comparable, Value any, NewKey comparable](m map[Key]Value, fn func(Key) NewKey) map[NewKey]Value {
output := make(map[NewKey]Value)
output := make(map[NewKey]Value, len(m))
for key, value := range m {
output[fn(key)] = value
}