gitlab.com/evatix-go/core@v1.3.55/converters/KeysValuesStringsToMapPtr.go (about)

     1  package converters
     2  
     3  // KeysValuesStringsToMapPtr keys nil will return empty map[string]string
     4  func KeysValuesStringsToMapPtr(keys, values *[]string) *map[string]string {
     5  	if keys == nil || *keys == nil {
     6  		var emptyResult map[string]string
     7  
     8  		return &emptyResult
     9  	}
    10  
    11  	newArray := make(map[string]string, len(*keys))
    12  
    13  	for i, key := range *keys {
    14  		newArray[key] = (*values)[i]
    15  	}
    16  
    17  	return &newArray
    18  }