slicesx

package
v1.0.0-beta.145 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunk

func Chunk[T any](s []T, size int) [][]T

Chunk splits a slice into chunks of the given size. The last chunk may be smaller than the given size.

func Dedupe

func Dedupe[T comparable](s []T) []T

func Filter

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

func First

func First[T any](s []T, f func(T) bool, last bool) (*T, bool)

returns the first element in the slice where the predicate returns true if second argument is true the returns the last not the first

func Map

func Map[T any, S any](s []T, f func(T) S) []S

Map maps elements of a slice from T to M, returning a new slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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