mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
rm unused helpers
This commit is contained in:
parent
2c14e39864
commit
c9072e55c4
1 changed files with 0 additions and 26 deletions
|
|
@ -7,29 +7,3 @@ func mapArray[A any, B any](coll []A, mapper func(i A, index uint64) B) []B {
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func filterArray[A any](coll []A, criteria func(i A) bool) []A {
|
|
||||||
out := []A{}
|
|
||||||
for _, item := range coll {
|
|
||||||
if criteria(item) {
|
|
||||||
out = append(out, item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
func reduceArray[A any, B any](coll []A, processor func(accum B, next A) B, initialState B) B {
|
|
||||||
val := initialState
|
|
||||||
for _, item := range coll {
|
|
||||||
val = processor(val, item)
|
|
||||||
}
|
|
||||||
return val
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenArrays[A any](coll [][]A) []A {
|
|
||||||
out := []A{}
|
|
||||||
for _, arr := range coll {
|
|
||||||
out = append(out, arr...)
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue