maputils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package maputils provides essential map manipulation utilities. Maps are like dictionaries but for code (and less helpful with definitions)

Index

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.