updated dependencies and go

This commit is contained in:
2026-04-21 11:06:01 +02:00
parent f62e7499ec
commit 84b87d61f2
91 changed files with 551 additions and 637 deletions
+5 -9
View File
@@ -1,5 +1,7 @@
package langext
import "maps"
import "encoding/json"
type MapEntry[T comparable, V any] struct {
@@ -60,9 +62,7 @@ func MapToArr[T comparable, V any](v map[T]V) []MapEntry[T, V] {
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
}
maps.Copy(result, a)
return result
}
@@ -90,14 +90,10 @@ func ForceJsonMapOrPanic(v any) map[string]any {
func MapMerge[K comparable, V any](base map[K]V, arr ...map[K]V) map[K]V {
res := make(map[K]V, len(base)*(1+len(arr)))
for k, v := range base {
res[k] = v
}
maps.Copy(res, base)
for _, m := range arr {
for k, v := range m {
res[k] = v
}
maps.Copy(res, m)
}
return res