github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/replace.go (about)

     1  package functions
     2  
     3  import "strings"
     4  
     5  func Replace(args ...interface{}) interface{} {
     6  	if len(args) != 3 {
     7  		return ""
     8  	}
     9  
    10  	input, ok := args[0].(string)
    11  	if !ok {
    12  		return ""
    13  	}
    14  
    15  	old, ok := args[1].(string)
    16  	if !ok {
    17  		return ""
    18  	}
    19  
    20  	new, ok := args[2].(string)
    21  	if !ok {
    22  		return ""
    23  	}
    24  
    25  	return strings.ReplaceAll(input, old, new)
    26  }