summaryrefslogtreecommitdiff
path: root/vendor/github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi/resetmap.go
blob: 3fc7aa143db062a206cf08528ae0d18143648937 (plain)
1
2
3
4
5
6
7
8
9
10
11
package wazevoapi

// ResetMap resets the map to an empty state, or creates a new map if it is nil.
func ResetMap[K comparable, V any](m map[K]V) map[K]V {
	if m == nil {
		m = make(map[K]V)
	} else {
		clear(m)
	}
	return m
}