sliceutil

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package sliceutil contains generic functions for working with slices. Use it to augment the std "slices" package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveCommonPrefix

func RemoveCommonPrefix[T comparable](a, b []T) (newA, newB []T)

RemoveCommonPrefix removes the shared prefix from the two provided slices, returning what remains for each slice as the result.

func RemoveFunc

func RemoveFunc[T any](items []T, skip func(T) bool) []T

RemoveFunc removes items matching the given function from the provided slice.

The original slice must not be used after this.

func Transform

func Transform[From, To any](from []From, f func(From) To) []To

Transform builds a slice by applying the provided function to all elements in the given slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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