Skip to content

Commit

Permalink
refactor: add MergeMaps utility
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Sep 5, 2024
1 parent 56e3ba7 commit d70208a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions internal/util/maps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package util

import (
"maps"
)

func MergeMaps[M ~map[K]V, K comparable, V any](items ...M) M {
acc := make(M)
for _, item := range items {
maps.Copy(acc, item)
}
return acc
}

0 comments on commit d70208a

Please sign in to comment.