common

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package common the js common

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(call goja.FunctionCall, vm *goja.Runtime) goja.Value

Format implements js format

func Throw

func Throw(vm *goja.Runtime, err error)

Throw js exception

func ToBytes

func ToBytes(data any) ([]byte, error)

ToBytes tries to return a byte slice from compatible types.

func ToStrings

func ToStrings(data any) (s any, err error)

ToStrings tries to return a string slice or string from compatible types.

func Unwrap

func Unwrap(value goja.Value) (any, error)

Unwrap the goja.Value to the raw value

Types

type FieldNameMapper

type FieldNameMapper struct{}

FieldNameMapper provides custom mapping between Go and JavaScript property names.

func (FieldNameMapper) FieldName

FieldName returns a JavaScript name for the given struct field in the given type. If this method returns "" the field becomes hidden.

func (FieldNameMapper) MethodName

func (FieldNameMapper) MethodName(_ reflect.Type, m reflect.Method) string

MethodName returns a JavaScript name for the given method in the given type. If this method returns "" the method becomes hidden.

type Program

type Program struct {
	Code string
	Args map[string]any
}

Program The js program

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL