Back to Lo

Core Intersectby

docs/data/core-intersectby.md

1.53.0254 B
Original Source

Returns the intersection between two collections using a custom key selector function.

go
transform := func(v int) string {
  return strconv.Itoa(v)
}

lo.IntersectBy(transform, []int{0, 3, 5, 7}, []int{3, 5}, []int{0, 1, 2, 0, 3, 0})
// []int{3}