console.go 1007 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package otto
  2. import (
  3. "fmt"
  4. "os"
  5. "strings"
  6. )
  7. func formatForConsole(argumentList []Value) string {
  8. output := []string{}
  9. for _, argument := range argumentList {
  10. output = append(output, fmt.Sprintf("%v", argument))
  11. }
  12. return strings.Join(output, " ")
  13. }
  14. func builtinConsoleLog(call FunctionCall) Value {
  15. fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList)) //nolint:errcheck // Nothing we can do if this fails.
  16. return Value{}
  17. }
  18. func builtinConsoleError(call FunctionCall) Value {
  19. fmt.Fprintln(os.Stdout, formatForConsole(call.ArgumentList)) //nolint:errcheck // Nothing we can do if this fails.
  20. return Value{}
  21. }
  22. // Nothing happens.
  23. func builtinConsoleDir(call FunctionCall) Value {
  24. return Value{}
  25. }
  26. func builtinConsoleTime(call FunctionCall) Value {
  27. return Value{}
  28. }
  29. func builtinConsoleTimeEnd(call FunctionCall) Value {
  30. return Value{}
  31. }
  32. func builtinConsoleTrace(call FunctionCall) Value {
  33. return Value{}
  34. }
  35. func builtinConsoleAssert(call FunctionCall) Value {
  36. return Value{}
  37. }