maps

package
v0.12.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package maps provides functions for manipulating maps.

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL