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

     1  package functions
     2  
     3  import "strings"
     4  
     5  func Bool(args ...interface{}) interface{} {
     6  	if len(args) != 1 {
     7  		return false
     8  	}
     9  
    10  	switch input := args[0].(type) {
    11  	case bool:
    12  		return input
    13  	case string:
    14  		input = strings.ToLower(input)
    15  		return input == "true" || input == "1" || input == "yes" || input == "on"
    16  	case int:
    17  		return input == 1
    18  	}
    19  	return false
    20  }