Skip to content

Commit d70208a

Browse files
committed
refactor: add MergeMaps utility
1 parent 56e3ba7 commit d70208a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

internal/util/maps.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package util
2+
3+
import (
4+
"maps"
5+
)
6+
7+
func MergeMaps[M ~map[K]V, K comparable, V any](items ...M) M {
8+
acc := make(M)
9+
for _, item := range items {
10+
maps.Copy(acc, item)
11+
}
12+
return acc
13+
}

0 commit comments

Comments
 (0)