gitlab.com/evatix-go/core@v1.3.55/coredata/corestr/CloneSliceIf.go (about)

     1  package corestr
     2  
     3  func CloneSliceIf(
     4  	isClone bool,
     5  	sourceItems ...string,
     6  ) []string {
     7  	if len(sourceItems) == 0 {
     8  		return []string{}
     9  	}
    10  
    11  	if !isClone {
    12  		return sourceItems
    13  	}
    14  
    15  	destinationSlice := make(
    16  		[]string,
    17  		len(sourceItems))
    18  	copy(destinationSlice, sourceItems)
    19  
    20  	return destinationSlice
    21  }