Documentation
¶
Overview ¶
Package maps provides functions for manipulating maps.
Index ¶
- func Add[K comparable, V any](m *map[K]V, k K, v V)
- func AddAll[K comparable, V any](m *map[K]V, ps ...godash.Pair[K, V])
- func Contains[K comparable, V any](m map[K]V, k K) bool
- func FromMap[K comparable, V any](m map[K]V) (ps []godash.Pair[K, V])
- func Keys[K comparable, V any](m map[K]V) (ks []K)
- func Remove[K comparable, V any](m *map[K]V, k K)
- func RemoveAll[K comparable, V any](m *map[K]V, ks ...K)
- func ToMap[K comparable, V any](ps ...godash.Pair[K, V]) (m map[K]V)
- func Values[K comparable, V any](m map[K]V) (vs []V)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add[K comparable, V any](m *map[K]V, k K, v V)
Add adds the key value pair to the map. Mostly created for consistency with HashableMap. Modifies the map in place, does not return a new map.
func AddAll ¶
func AddAll[K comparable, V any](m *map[K]V, ps ...godash.Pair[K, V])
AddAll adds the key value pairs to the map. Modifies the map in place, does not return a new map.
func Contains ¶
func Contains[K comparable, V any](m map[K]V, k K) bool
Contains returns true if the map contains the key.
func FromMap ¶
func FromMap[K comparable, V any](m map[K]V) (ps []godash.Pair[K, V])
FromMap returns an array of the key value pairs in the map.
func Keys ¶
func Keys[K comparable, V any](m map[K]V) (ks []K)
Keys returns a slice of the keys in the map.
func Remove ¶
func Remove[K comparable, V any](m *map[K]V, k K)
Remove removes the key and associated value from the map. Mostly created for consistency with HashableMap.
func RemoveAll ¶
func RemoveAll[K comparable, V any](m *map[K]V, ks ...K)
RemoveAll removes the keys with the associated values from the map.
func ToMap ¶
func ToMap[K comparable, V any](ps ...godash.Pair[K, V]) (m map[K]V)
ToMap returns a map of the key value pairs passed in.
func Values ¶
func Values[K comparable, V any](m map[K]V) (vs []V)
Values returns a slice of the values in the map.
Types ¶
This section is empty.