gitlab.com/evatix-go/core@v1.3.55/namevalue/AppendsIf.go (about)

     1  package namevalue
     2  
     3  func AppendsIf(
     4  	isAdd bool,
     5  	nameValues []Instance,
     6  	appendingItems ...Instance,
     7  ) []Instance {
     8  	if !isAdd || len(appendingItems) == 0 {
     9  		return nameValues
    10  	}
    11  
    12  	nameValues = append(
    13  		nameValues,
    14  		appendingItems...)
    15  
    16  	return nameValues
    17  }