Back to Lo

Core Rejectmap

docs/data/core-rejectmap.md

1.53.0227 B
Original Source

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

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