Documentation
¶
Overview ¶
Package dict is a package of generic-type functions for map.
Index ¶
- func Copy[K comparable, V any](m map[K]V) map[K]V
- func Entries[K comparable, V any](m map[K]V) []gust.DictEntry[K, V]
- func Every[K comparable, V any](m map[K]V, fn func(k K, v V) bool) bool
- func Filter[K comparable, V any](m map[K]V, fn func(K, V) bool) map[K]V
- func FilterMap[K comparable, V any, K2 comparable, V2 any](m map[K]V, fn func(K, V) gust.Option[gust.DictEntry[K2, V2]]) map[K2]V2
- func FilterMapKey[K comparable, V any, K2 comparable](m map[K]V, fn func(K, V) gust.Option[gust.DictEntry[K2, V]]) map[K2]V
- func FilterMapValue[K comparable, V any, V2 any](m map[K]V, fn func(K, V) gust.Option[gust.DictEntry[K, V2]]) map[K]V2
- func Find[K comparable, V any](m map[K]V, fn func(K, V) bool) gust.Option[gust.DictEntry[K, V]]
- func Get[K comparable, V any](m map[K]V, k K) gust.Option[V]
- func Keys[K comparable, V any](m map[K]V) []K
- func Map[K comparable, V any, K2 comparable, V2 any](m map[K]V, mapping func(K, V) gust.DictEntry[K2, V2]) map[K2]V2
- func MapCurry[K comparable, V any, K2 comparable, V2 any](m map[K]V, keyMapping func(K) K2) func(valueMapping func(V) V2) map[K2]V2
- func MapKey[K comparable, V any, K2 comparable](m map[K]V, mapping func(K, V) K2) map[K2]V
- func MapKeyAlone[K comparable, V any, K2 comparable](m map[K]V, mapping func(K) K2) map[K2]V
- func MapValue[K comparable, V any, V2 any](m map[K]V, mapping func(K, V) V2) map[K]V2
- func MapValueAlone[K comparable, V any, V2 any](m map[K]V, mapping func(V) V2) map[K]V2
- func Some[K comparable, V any](m map[K]V, fn func(K, V) bool) bool
- func Values[K comparable, V any](m map[K]V) []V
- func Vec[K comparable, V any, T any](m map[K]V, set func(K, V) T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Entries ¶
func Entries[K comparable, V any](m map[K]V) []gust.DictEntry[K, V]
Entries returns the entries of map.
func Every ¶
func Every[K comparable, V any](m map[K]V, fn func(k K, v V) bool) bool
Every tests whether all entries in the map pass the test implemented by the provided function. NOTE:
Calling this method on an empty map will return true for any condition!
func Filter ¶
func Filter[K comparable, V any](m map[K]V, fn func(K, V) bool) map[K]V
Filter creates a new map with all elements that pass the test implemented by the provided function.
func FilterMap ¶
func FilterMap[K comparable, V any, K2 comparable, V2 any](m map[K]V, fn func(K, V) gust.Option[gust.DictEntry[K2, V2]]) map[K2]V2
FilterMap returns a filtered and mapped map of new entries.
func FilterMapKey ¶
func FilterMapKey[K comparable, V any, K2 comparable](m map[K]V, fn func(K, V) gust.Option[gust.DictEntry[K2, V]]) map[K2]V
FilterMapKey returns a filtered and mapped map of new entries.
func FilterMapValue ¶
func FilterMapValue[K comparable, V any, V2 any](m map[K]V, fn func(K, V) gust.Option[gust.DictEntry[K, V2]]) map[K]V2
FilterMapValue returns a filtered and mapped map of new entries.
func Get ¶ added in v1.5.0
func Get[K comparable, V any](m map[K]V, k K) gust.Option[V]
Get returns the gust.Option[V] of the entry for the provided key.
func Map ¶
func Map[K comparable, V any, K2 comparable, V2 any](m map[K]V, mapping func(K, V) gust.DictEntry[K2, V2]) map[K2]V2
Map creates a new map populated with the results of calling a provided function on every entry in the calling map.
func MapCurry ¶
func MapCurry[K comparable, V any, K2 comparable, V2 any](m map[K]V, keyMapping func(K) K2) func(valueMapping func(V) V2) map[K2]V2
MapCurry creates a new map populated with the results of calling a provided function on every entry in the calling map.
func MapKey ¶
func MapKey[K comparable, V any, K2 comparable](m map[K]V, mapping func(K, V) K2) map[K2]V
MapKey creates a new map populated with the results of calling a provided function on every entry in the calling map.
func MapKeyAlone ¶
func MapKeyAlone[K comparable, V any, K2 comparable](m map[K]V, mapping func(K) K2) map[K2]V
MapKeyAlone creates a new map populated with the results of calling a provided function on every entry in the calling map.
func MapValue ¶
func MapValue[K comparable, V any, V2 any](m map[K]V, mapping func(K, V) V2) map[K]V2
MapValue creates a new map populated with the results of calling a provided function on every entry in the calling map.
func MapValueAlone ¶
func MapValueAlone[K comparable, V any, V2 any](m map[K]V, mapping func(V) V2) map[K]V2
MapValueAlone creates a new map populated with the results of calling a provided function on every entry in the calling map.
func Some ¶
func Some[K comparable, V any](m map[K]V, fn func(K, V) bool) bool
Some tests whether at least one entry in the map passes the test implemented by the provided function. NOTE:
Calling this method on an empty map returns false for any condition!
func Vec ¶ added in v1.5.0
func Vec[K comparable, V any, T any](m map[K]V, set func(K, V) T) []T
Vec generates an orderless slice through the set function.
Types ¶
This section is empty.