Documentation
¶
Index ¶
- Constants
- Variables
- func CreateARDExtension(jsContext *commonjs.Context) any
- func CreateConsoleExtension(jsContext *commonjs.Context) any
- func CreateEarlyBindExtension(jsContext *commonjs.Context) any
- func CreateEnvExtension(arguments map[string]string) commonjs.CreateExtensionFunc
- func CreateLateBindExtension(jsContext *commonjs.Context) any
- func CreateOSExtension(jsContext *commonjs.Context) any
- func CreateTranscribeExtension(stdout io.Writer, stderr io.Writer) commonjs.CreateExtensionFunc
- func CreateUtilExtension(jsContext *commonjs.Context) any
- type ARD
- type Console
- type DefaultExtensions
- type Env
- type OS
- func (self OS) Download(sourceUrl string, targetPath string, timeoutSeconds float64) error
- func (self OS) Exec(name string, arguments ...string) (string, error)
- func (self OS) JoinFilePath(elements ...string) string
- func (self OS) TemporaryDirectory(pattern string, directory string) (string, error)
- func (self OS) TemporaryFile(pattern string, directory string) (string, error)
- type Transcribe
- func (self Transcribe) Atob(b64 string) ([]byte, error)
- func (self Transcribe) Eprint(value any, format string, indent string) error
- func (self Transcribe) NewXmlDocument() *etree.Document
- func (self Transcribe) Print(value any, format string, indent string) error
- func (self Transcribe) Stringify(value any, format string, indent string) (string, error)
- func (self Transcribe) Write(writer io.Writer, value any, format string, indent string) error
- func (self Transcribe) WriteText(writer io.Writer, value any, format string, indent string) error
- type Util
- func (self *Util) Btoa(bytes []byte) string
- func (self *Util) BytesToString(bytes []byte) string
- func (self *Util) DeepCopy(value ard.Value) ard.Value
- func (self *Util) DeepEquals(a ard.Value, b ard.Value) bool
- func (self *Util) EscapeHtml(text string) string
- func (self *Util) Fail(message string)
- func (self *Util) Failf(format string, args ...any)
- func (self *Util) Go(value goja.Value, this goja.Value, arguments []goja.Value) error
- func (self *Util) Hash(value ard.Value) (uint64, error)
- func (self *Util) IsType(value ard.Value, typeName string) (bool, error)
- func (self *Util) Mutex() util.RWLocker
- func (self *Util) Now() time.Time
- func (self *Util) NowString() string
- func (self *Util) Once(name string, value goja.Value, this goja.Value, arguments []goja.Value) error
- func (self *Util) Sprintf(format string, args ...any) string
- func (self *Util) StringToBytes(string_ string) []byte
- func (self *Util) UnescapeHtml(text string) string
- func (self *Util) Url(config ard.StringMap) (string, error)
Constants ¶
const LOG_DEPTH = 4 // skip through reflection to goja code
Variables ¶
var Variables = commonjs.NewThreadSafeObject()
Functions ¶
func CreateARDExtension ¶
func CreateARDExtension(jsContext *commonjs.Context) any
(commonjs.CreateExtensionFunc signature)
func CreateConsoleExtension ¶
func CreateConsoleExtension(jsContext *commonjs.Context) any
(commonjs.CreateExtensionFunc signature)
func CreateEarlyBindExtension ¶
func CreateEarlyBindExtension(jsContext *commonjs.Context) any
(commonjs.CreateExtensionFunc signature)
func CreateEnvExtension ¶
func CreateLateBindExtension ¶
func CreateLateBindExtension(jsContext *commonjs.Context) any
(commonjs.CreateExtensionFunc signature)
func CreateOSExtension ¶
func CreateOSExtension(jsContext *commonjs.Context) any
(commonjs.CreateExtensionFunc signature)
func CreateUtilExtension ¶
func CreateUtilExtension(jsContext *commonjs.Context) any
(commonjs.CreateExtensionFunc signature)
Types ¶
type Console ¶
type Console struct {
// contains filtered or unexported fields
}
func NewConsole ¶
func NewConsole(jsContext *commonjs.Context) *Console
type DefaultExtensions ¶
type DefaultExtensions struct { LateBind bool Arguments map[string]string Stdout io.Writer Stderr io.Writer }
func (DefaultExtensions) Create ¶
func (self DefaultExtensions) Create() []commonjs.Extension
type Env ¶
type Env struct { Context *commonjs.Context Variables *goja.Object Arguments map[string]string Log commonlog.Logger }
func (*Env) LoadString ¶
type Transcribe ¶
func NewTranscribe ¶
func NewTranscribe(stdout io.Writer, stderr io.Writer) *Transcribe
func (Transcribe) Atob ¶
func (self Transcribe) Atob(b64 string) ([]byte, error)
Decode base64 to bytes
func (Transcribe) Eprint ¶
func (self Transcribe) Eprint(value any, format string, indent string) error
func (Transcribe) NewXmlDocument ¶
func (self Transcribe) NewXmlDocument() *etree.Document
func (Transcribe) Print ¶
func (self Transcribe) Print(value any, format string, indent string) error
Encodes and prints the value to stdout. Supported formats are "yaml", "json", "xjson", "xml", "cbor", "messagepack", and "go". The "cbor" and "messsagepack" formats will be encoded in base64 and will ignore the indent argument.
func (Transcribe) Stringify ¶
Encodes the value into a string.Supported formats are "yaml", "json", "xjson", "xml", "cbor", "messagepack", and "go". The "cbor" and "messsagepack" formats will be encoded in base64 and will ignore the indent argument.
func (Transcribe) Write ¶
Encodes and writes the value. Supported formats are "yaml", "json", "xjson", "xml", "cbor", "messagepack", and "go". The "cbor" and "messsagepack" formats will ignore the indent argument.
type Util ¶
type Util struct {
// contains filtered or unexported fields
}
func (*Util) BytesToString ¶
Another way to achieve this in JavaScript: String.fromCharCode.apply(null, bytes)
func (*Util) DeepEquals ¶
func (*Util) EscapeHtml ¶
func (*Util) StringToBytes ¶
func (*Util) UnescapeHtml ¶
func (*Util) Url ¶
Construct a URL via its parts. Supports parts:
- "scheme": as string
- "username": as string
- "password": as string
- "host": as string
- "port": as unsigned integer
- "path": as string
- "query": map of strings to either a list of multiple values or or a single value as string
- "fragment": as string