Files
lo/docs/data/core-rejectmap.md
T
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00

643 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
RejectMap rejectmap slice.go#L550 core slice https://go.dev/play/p/bmXhtuM2OMq
core#slice#rejectmap
core#slice#filtermap
core#slice#map
core#slice#filter
core#slice#reject
270
func RejectMap[T any, R any](collection []T, callback func(item T, index int) (R, bool)) []R

Opposite of FilterMap: maps each item and includes results where the predicate returned false.

items := lo.RejectMap([]int{1, 2, 3, 4}, func(x int, _ int) (int, bool) {
    return x * 10, x%2 == 0
})
// []int{10, 30}