mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
Places, Agents, Serials, Entries
This commit is contained in:
9
helpers/datatypes/map.go
Normal file
9
helpers/datatypes/map.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package datatypes
|
||||
|
||||
func MakeMap[T any, U comparable](data []T, f func(T) U) map[U]T {
|
||||
m := make(map[U]T)
|
||||
for _, v := range data {
|
||||
m[f(v)] = v
|
||||
}
|
||||
return m
|
||||
}
|
||||
Reference in New Issue
Block a user