sliceutil

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendUnique added in v0.22.0

func AppendUnique[T comparable](vs []T, toAdd T) []T

IntAppendUnique appends toAdd to the vs int slice if toAdd does not already exist in the slice. It returns the new or unchanged int slice.

func AppendUniques added in v0.22.0

func AppendUniques[T comparable](vs []T, toAdd []T) []T

IntAppendUniques appends a slice of values to the vs slice. It only appends values that do not already exist in the slice. It returns the new or unchanged slice.

func Exclude added in v0.22.0

func Exclude[T comparable](vs []T, toExclude []T) []T

Exclude removes all instances of any value in toExclude from the vs slice. It returns the new or unchanged slice.

func Include added in v0.22.0

func Include[T comparable](vs []T, t T) bool

func Index added in v0.22.0

func Index[T comparable](vs []T, t T) int

func SliceSame

func SliceSame(a, b interface{}) bool

SliceSame returns true if the two provided lists have the same elements, regardless of order. Panics if either parameter is not a slice.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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