github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/last.go (about) 1 package functions 2 3 func Last(args ...interface{}) interface{} { 4 if len(args) != 1 { 5 return "" 6 } 7 8 container := args[0] 9 10 switch cType := container.(type) { 11 case string: 12 if len(cType) > 0 { 13 return string(cType[len(cType)-1]) 14 } 15 case interface{}: 16 switch iType := cType.(type) { 17 case []string: 18 if len(iType) > 0 { 19 return iType[len(iType)-1] 20 } 21 case []bool: 22 if len(iType) > 0 { 23 return iType[len(iType)-1] 24 } 25 case []int: 26 if len(iType) > 0 { 27 return iType[len(iType)-1] 28 } 29 case []float64: 30 if len(iType) > 0 { 31 return iType[len(iType)-1] 32 } 33 } 34 } 35 36 return "" 37 }