mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 18:46:47 +00:00
* add logo and fix project image description * add difference function * update docs Co-authored-by: Ruidy <rnemausat@newstore.com>
8 lines
264 B
Go
8 lines
264 B
Go
package underscore
|
|
|
|
// Difference Returns a copy of the array with all instances of the values that are not present in the other array.
|
|
func Difference[T comparable](slice, other []T) []T {
|
|
return Filter(slice, func(n T) bool {
|
|
return !Contains(other, n)
|
|
})
|
|
}
|