gitlab.com/evatix-go/core@v1.3.55/coredata/stringslice/AppendStringsWithAnyItems.go (about)

     1  package stringslice
     2  
     3  import "gitlab.com/evatix-go/core/constants"
     4  
     5  func AppendStringsWithAnyItems(
     6  	isClone,
     7  	isSkipOnEmpty bool,
     8  	mainSlice []interface{},
     9  	appendingItems ...string,
    10  ) []interface{} {
    11  	slice := AnyItemsCloneIf(
    12  		isClone,
    13  		len(appendingItems)+constants.Capacity2,
    14  		mainSlice)
    15  
    16  	if len(appendingItems) == 0 {
    17  		return slice
    18  	}
    19  
    20  	for _, item := range appendingItems {
    21  		if isSkipOnEmpty && item == "" {
    22  			continue
    23  		}
    24  
    25  		slice = append(
    26  			slice,
    27  			item)
    28  	}
    29  
    30  	return slice
    31  }