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

     1  package stringslice
     2  
     3  func ProcessOptionAsync(
     4  	isSkipOnNil bool,
     5  	processor func(index int, item interface{}) string,
     6  	items ...interface{},
     7  ) []string {
     8  	if len(items) == 0 {
     9  		return []string{}
    10  	}
    11  
    12  	list := ProcessAsync(processor, items...)
    13  
    14  	if !isSkipOnNil {
    15  		return list
    16  	}
    17  
    18  	newSlice := make([]string, 0, len(list))
    19  
    20  	for _, item := range list {
    21  		if item == "" {
    22  			continue
    23  		}
    24  
    25  		newSlice = append(newSlice, item)
    26  	}
    27  
    28  	return newSlice
    29  }