Documentation
¶
Overview ¶
Package maputils provides essential map manipulation utilities. Maps are like dictionaries but for code (and less helpful with definitions)
Index ¶
- func Clone[K comparable, V any](m map[K]V) map[K]V
- func Equal[K comparable, V comparable](m1, m2 map[K]V) bool
- func Filter[K comparable, V any](m map[K]V, predicate func(K, V) bool) map[K]V
- func Keys[K comparable, V any](m map[K]V) []K
- func Map[K comparable, V, R any](m map[K]V, transform func(V) R) map[K]R
- func Merge[K comparable, V any](maps ...map[K]V) map[K]V
- func Values[K comparable, V any](m map[K]V) []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
func Clone[K comparable, V any](m map[K]V) map[K]V
Clone creates shallow copy of a map.
func Equal ¶
func Equal[K comparable, V comparable](m1, m2 map[K]V) bool
Equal checks if two maps are equal.
func Filter ¶
func Filter[K comparable, V any](m map[K]V, predicate func(K, V) bool) map[K]V
Filter returns new map with entries matching predicate.
func Keys ¶
func Keys[K comparable, V any](m map[K]V) []K
Keys returns slice of all keys in the map.
func Map ¶
func Map[K comparable, V, R any](m map[K]V, transform func(V) R) map[K]R
Map transforms all values using transform function.
func Merge ¶
func Merge[K comparable, V any](maps ...map[K]V) map[K]V
Merge combines multiple maps, later maps override earlier ones. Last one wins, just like in arguments with my siblings
func Values ¶
func Values[K comparable, V any](m map[K]V) []V
Values returns slice of all values in the map.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.