v0.0.391
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m36s

This commit is contained in:
Mike Schwörer 2024-02-21 16:18:04 +01:00
parent c399fa42ae
commit 4b55dbaacf
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 21 additions and 2 deletions

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.390"
const GoextVersion = "0.0.391"
const GoextVersionTimestamp = "2024-02-21T16:11:15+0100"
const GoextVersionTimestamp = "2024-02-21T16:18:04+0100"

View File

@ -265,6 +265,15 @@ func ArrFirstIndex[T comparable](arr []T, needle T) int {
return -1
}
func ArrFirstIndexFunc[T any](arr []T, comp func(v T) bool) int {
for i, v := range arr {
if comp(v) {
return i
}
}
return -1
}
func ArrLastIndex[T comparable](arr []T, needle T) int {
result := -1
for i, v := range arr {
@ -275,6 +284,16 @@ func ArrLastIndex[T comparable](arr []T, needle T) int {
return result
}
func ArrLastIndexFunc[T any](arr []T, comp func(v T) bool) int {
result := -1
for i, v := range arr {
if comp(v) {
result = i
}
}
return result
}
func AddToSet[T comparable](set []T, add T) []T {
for _, v := range set {
if v == add {