Back to Lo

Core Uniq

docs/data/core-uniq.md

1.53.0166 B
Original Source

Returns a duplicate-free version of a slice, keeping only the first occurrence of each value. Order is preserved.

go
lo.Uniq([]int{1, 2, 2, 1})
// []int{1, 2}