github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/util/strings.go (about)

     1  package util
     2  
     3  // StringsContain returns true if the search value is within the list of input values.
     4  func StringsContain(values []string, search string) bool {
     5  	for _, v := range values {
     6  		if search == v {
     7  			return true
     8  		}
     9  	}
    10  
    11  	return false
    12  }
    13  
    14  // StringsMap returns a map where keys are input values.
    15  func StringsMap(values []string) map[string]bool {
    16  	out := make(map[string]bool, len(values))
    17  	for _, v := range values {
    18  		out[v] = true
    19  	}
    20  	return out
    21  }