slices

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](slice []T, value T) bool

Contains returns true if any of the slice elements pass an == test w/ the given 'value'.

func Map

func Map[T any, U any](slice []T, mapper func(T) U) []U

Map performs a functional Map operation where you convert a slice of type T to a slice of type U by running every element through a mapping function.

func Remove

func Remove[T comparable](slice []T, value T) []T

Remove is a generic way to remove the first instance of 'value' from the given slice. If the item does not exist in the slice, you'll get back your input slice as-is. This does not mutate your input slice - it returns a new slice without the value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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