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

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