xgeneric

package module
v0.0.0-...-6e5f2ed Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunk

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

Chunk returns an array of elements split into groups the length of size.

func Filter

func Filter[V any](collection []V, predicate func(V, int) bool) []V

Filter iterates over elements of collection, returning an array of all elements predicate returns truthy for.

func Map

func Map[T any, R any](collection []T, iteratee func(T, int) R) []R

Map manipulates a slice and transforms it to a slice of another type.

func Shuffle

func Shuffle[T any](collection []T) []T

Shuffle returns an array of shuffled values. Uses the Fisher-Yates shuffle algorithm.

func Subset

func Subset[T any](collection []T, offset int, limit uint) []T

Subset return part of a slice.

func Uniq

func Uniq[T comparable](collection []T) []T

Uniq returns a duplicate-free version of an array

Types

This section is empty.

Jump to

Keyboard shortcuts

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