From 2f66ab1cf04e7054e81e9d92ee4f6722a20e6762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sun, 23 Apr 2023 19:31:48 +0200 Subject: [PATCH] v0.0.105 --- langext/maps.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/langext/maps.go b/langext/maps.go index 6f06ed4..4a5cd11 100644 --- a/langext/maps.go +++ b/langext/maps.go @@ -15,3 +15,11 @@ func ArrToMap[T comparable, V any](a []V, keyfunc func(V) T) map[T]V { } return result } + +func CopyMap[K comparable, V any](a map[K]V) map[K]V { + result := make(map[K]V, len(a)) + for k, v := range a { + result[k] = v + } + return result +}