SliceContains returns true if it finds an item in the slice that is equal to the target
(slice []T, target T)
| 10 | |
| 11 | // SliceContains returns true if it finds an item in the slice that is equal to the target |
| 12 | func SliceContains[T comparable](slice []T, target T) bool { |
| 13 | for _, item := range slice { |
| 14 | if item == target { |
| 15 | return true |
| 16 | } |
| 17 | } |
| 18 | return false |
| 19 | } |
| 20 | |
| 21 | // SliceContainsSlice returns true all items in the target are equal to items in the slice |
| 22 | func SliceContainsSlice[T comparable](slice []T, target []T) bool { |
no outgoing calls
no test coverage detected