resetmap.go

 1package wazevoapi
 2
 3// ResetMap resets the map to an empty state, or creates a new map if it is nil.
 4func ResetMap[K comparable, V any](m map[K]V) map[K]V {
 5	if m == nil {
 6		m = make(map[K]V)
 7	} else {
 8		clear(m)
 9	}
10	return m
11}