MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / SliceContainsSlice

Function SliceContainsSlice

pkg/util/util.go:22–33  ·  view source on GitHub ↗

SliceContainsSlice returns true all items in the target are equal to items in the slice

(slice []T, target []T)

Source from the content-addressed store, hash-verified

20
21// SliceContainsSlice returns true all items in the target are equal to items in the slice
22func SliceContainsSlice[T comparable](slice []T, target []T) bool {
23 var containsAllElementsOfTarget = true
24 for _, targetElement := range target {
25 if SliceContains(slice, targetElement) {
26 containsAllElementsOfTarget = true
27 } else {
28 return false
29 }
30 }
31
32 return containsAllElementsOfTarget
33}
34
35// SliceEquals returns true if the slices have the same string contents, regardless of order
36func SliceEquals(slice []string, target []string) bool {

Callers 2

Calls 1

SliceContainsFunction · 0.85

Tested by

no test coverage detected