func-string.go: commented out the param count check

This commit is contained in:
Celestino Amoroso 2024-05-15 22:03:03 +02:00
parent 52ef134be6
commit 35e794701a

View File

@ -33,9 +33,9 @@ func doJoinStr(funcName string, sep string, it Iterator) (result any, err error)
} }
func joinStrFunc(ctx ExprContext, name string, args []any) (result any, err error) { func joinStrFunc(ctx ExprContext, name string, args []any) (result any, err error) {
if len(args) < 1 { // if len(args) < 1 {
return nil, errMissingRequiredParameter(name, paramSeparator) // return nil, errMissingRequiredParameter(name, paramSeparator)
} // }
if sep, ok := args[0].(string); ok { if sep, ok := args[0].(string); ok {
if len(args) == 1 { if len(args) == 1 {
result = "" result = ""
@ -62,9 +62,9 @@ func subStrFunc(ctx ExprContext, name string, args []any) (result any, err error
var source string var source string
var ok bool var ok bool
if len(args) < 1 { // if len(args) < 1 {
return nil, errMissingRequiredParameter(name, paramSource) // return nil, errMissingRequiredParameter(name, paramSource)
} // }
if source, ok = args[0].(string); !ok { if source, ok = args[0].(string); !ok {
return nil, errWrongParamType(name, paramSource, typeString, args[0]) return nil, errWrongParamType(name, paramSource, typeString, args[0])
} }
@ -93,9 +93,9 @@ func trimStrFunc(ctx ExprContext, name string, args []any) (result any, err erro
var source string var source string
var ok bool var ok bool
if len(args) < 1 { // if len(args) < 1 {
return nil, errMissingRequiredParameter(name, paramSource) // return nil, errMissingRequiredParameter(name, paramSource)
} // }
if source, ok = args[0].(string); !ok { if source, ok = args[0].(string); !ok {
return nil, errWrongParamType(name, paramSource, typeString, args[0]) return nil, errWrongParamType(name, paramSource, typeString, args[0])
} }
@ -108,9 +108,9 @@ func startsWithStrFunc(ctx ExprContext, name string, args []any) (result any, er
var ok bool var ok bool
result = false result = false
if len(args) < 1 { // if len(args) < 1 {
return result, errMissingRequiredParameter(name, paramSource) // return result, errMissingRequiredParameter(name, paramSource)
} // }
if source, ok = args[0].(string); !ok { if source, ok = args[0].(string); !ok {
return result, errWrongParamType(name, paramSource, typeString, args[0]) return result, errWrongParamType(name, paramSource, typeString, args[0])
} }
@ -133,9 +133,9 @@ func endsWithStrFunc(ctx ExprContext, name string, args []any) (result any, err
var ok bool var ok bool
result = false result = false
if len(args) < 1 { // if len(args) < 1 {
return result, errMissingRequiredParameter(name, paramSource) // return result, errMissingRequiredParameter(name, paramSource)
} // }
if source, ok = args[0].(string); !ok { if source, ok = args[0].(string); !ok {
return result, errWrongParamType(name, paramSource, typeString, args[0]) return result, errWrongParamType(name, paramSource, typeString, args[0])
} }
@ -159,9 +159,9 @@ func splitStrFunc(ctx ExprContext, name string, args []any) (result any, err err
var parts []string var parts []string
var ok bool var ok bool
if len(args) < 1 { // if len(args) < 1 {
return result, errMissingRequiredParameter(name, paramSource) // return result, errMissingRequiredParameter(name, paramSource)
} // }
if source, ok = args[0].(string); !ok { if source, ok = args[0].(string); !ok {
return result, errWrongParamType(name, paramSource, typeString, args[0]) return result, errWrongParamType(name, paramSource, typeString, args[0])
} }