IsMapSubset returns true if mapSubset is a subset of mapSet otherwise false
(mapSet map[string]string, mapSubset map[string]string)
| 47 | |
| 48 | // IsMapSubset returns true if mapSubset is a subset of mapSet otherwise false |
| 49 | func IsMapSubset(mapSet map[string]string, mapSubset map[string]string) bool { |
| 50 | if len(mapSet) < len(mapSubset) { |
| 51 | return false |
| 52 | } |
| 53 | |
| 54 | if len(mapSubset) == 0 { |
| 55 | return true |
| 56 | } |
| 57 | |
| 58 | for subMapKey, subMapValue := range mapSubset { |
| 59 | mapValue := mapSet[subMapKey] |
| 60 | |
| 61 | if mapValue != subMapValue { |
| 62 | return false |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | return true |
| 67 | } |
| 68 | |
| 69 | // IsLabelSubset checks if a collection of labels is a subset of another |
| 70 | // |
no outgoing calls
no test coverage detected