removed channel dependency
This commit is contained in:
parent
2124bff9de
commit
4f3cf3f537
4
go.mod
4
go.mod
@ -1,5 +1,3 @@
|
|||||||
module git.milar.in/milarin/slices
|
module git.milar.in/milarin/slices
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require git.milar.in/milarin/channel v0.0.7
|
|
12
slices.go
12
slices.go
@ -1,9 +1,5 @@
|
|||||||
package slices
|
package slices
|
||||||
|
|
||||||
import (
|
|
||||||
"git.milar.in/milarin/channel"
|
|
||||||
)
|
|
||||||
|
|
||||||
func IndexOf[T comparable](slice []T, value T) int {
|
func IndexOf[T comparable](slice []T, value T) int {
|
||||||
return IndexOfCmp(slice, value, DefaultEqualityComparator[T])
|
return IndexOfCmp(slice, value, DefaultEqualityComparator[T])
|
||||||
}
|
}
|
||||||
@ -33,14 +29,6 @@ func Map[I, O any](slice []I, mapper func(I) O) []O {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func MapParallel[I, O any](slice []I, mapper func(I) O) []O {
|
|
||||||
return channel.ToSlice(channel.Map(channel.Of(slice...), mapper))
|
|
||||||
}
|
|
||||||
|
|
||||||
func MapParallelWithRunner[I, O any](slice []I, runner channel.Runner, mapper func(I) O) []O {
|
|
||||||
return channel.ToSlice(channel.MapWithRunner(channel.Of(slice...), runner, mapper))
|
|
||||||
}
|
|
||||||
|
|
||||||
func Each[T any](slice []T, f func(T)) {
|
func Each[T any](slice []T, f func(T)) {
|
||||||
EachIndex(slice, func(_ int, v T) { f(v) })
|
EachIndex(slice, func(_ int, v T) { f(v) })
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user