sliceutils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package sliceutils provides useful functions for dealing with slices https://gobyexample.com/collection-functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All[T any](vs []T, f func(T) bool) bool

All returns true if every one of the strings in vs satisfies f

func Any

func Any[T any](vs []T, f func(T) bool) bool

Any returns true if one of the values in vs satisfies f

func Filter

func Filter[T any](vs []T, f func(T) bool) []T

Filter returns a new slice containing all the strings in vs that satisfy f

func Includes

func Includes[T constraints.Ordered](vs []T, t T) bool

Includes returns true if t is contained within vs

func Index

func Index[T constraints.Ordered](vs []T, t T) int

Index returns the first index of t or -1 if no match

func Map

func Map[T any, K any](vs []T, f func(T) K) []K

Map returns a new slice containing the results of applying f to each value in vs

Types

This section is empty.

Jump to

Keyboard shortcuts

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