MCPcopy
hub / github.com/httprunner/httprunner / parseFunctionArguments

Function parseFunctionArguments

hrp/parser.go:409–433  ·  view source on GitHub ↗
(argsStr string)

Source from the content-addressed store, hash-verified

407}
408
409func parseFunctionArguments(argsStr string) ([]interface{}, error) {
410 argsStr = strings.TrimSpace(argsStr)
411 if argsStr == "" {
412 return []interface{}{}, nil
413 }
414
415 // split arguments by comma
416 args := strings.Split(argsStr, ",")
417 arguments := make([]interface{}, len(args))
418 for index, arg := range args {
419 arg = strings.TrimSpace(arg)
420 if arg == "" {
421 continue
422 }
423
424 // parse argument to number if possible
425 arg, err := literalEval(arg)
426 if err != nil {
427 return nil, err
428 }
429 arguments[index] = arg
430 }
431
432 return arguments, nil
433}
434
435func (p *Parser) ParseVariables(variables map[string]interface{}) (map[string]interface{}, error) {
436 parsedVariables := make(map[string]interface{})

Callers 2

ParseStringMethod · 0.85

Calls 1

literalEvalFunction · 0.85

Tested by 1