gitlab.com/evatix-go/core@v1.3.55/coredata/corejson/BytesCloneIf.go (about)

     1  package corejson
     2  
     3  func BytesCloneIf(
     4  	isDeepClone bool,
     5  	inputBytes []byte,
     6  ) []byte {
     7  	if !isDeepClone || len(inputBytes) == 0 {
     8  		return []byte{}
     9  	}
    10  
    11  	newBytes := make([]byte, 0, len(inputBytes))
    12  	copy(newBytes, inputBytes)
    13  
    14  	return newBytes
    15  }