arr

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package arr contains functions to interact with arrays.

The package is imported like this:

import "github.com/gouniverse/base/arr"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexMoveDown

func IndexMoveDown[T any](slice []T, index int) []T

indexMoveDown moves the element at the given index down

Business logic: - if the index is last index, will be ignored - if the index out of bounds, will be ignored

Parameters: - slice: the slice to move the element from - index: the index of the element to move

Returns: - []T: the new slice

func IndexMoveUp

func IndexMoveUp[T any](slice []T, index int) []T

indexMoveUp moves the element at the given index up

Business logic: - if the index is first index, will be ignored - if the index out of bounds, will be ignored

Parameters: - slice: the slice to move the element from - index: the index of the element to move

Returns: - []T: the new slice

func IndexRemove

func IndexRemove[T any](slice []T, index int) []T

indexRemove removes the element at the given index

Business logic: - if the index out of bounds, will be ignored

Parameters: - slice: the slice to remove the element from - index: the index of the element to remove

Returns: - []T: the 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