expr

package
v0.0.0-...-455f122 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Null = otto.NullValue()

TODO bah! unhappy about exporting a special null value.

maybe otto's type conversion needs a fix?

Functions

func Eval

func Eval(e cwl.Expression, libs []string, data map[string]interface{}) (interface{}, error)

Eval evaluates a string which is possibly a CWL expression. If the string is not an expression, the string is returned unchanged.

func EvalParts

func EvalParts(parts []*Part, libs []string, data map[string]interface{}) (interface{}, error)

EvalParts evaluates a string which has been parsed by Parse(). If the parts do not represent an expression, the original raw string is returned. This is a low-level function, it's better to use EvalString().

func IsExpression

func IsExpression(expr cwl.Expression) bool

IsExpression returns true if the given string contains a CWL expression.

Types

type Part

type Part struct {
	Raw        string
	Expr       string
	Start, End int
	// true if the expression is a javascript function body (e.g. ${return "foo"})
	IsFuncBody bool
}

Part describes a part of a CWL expression string which has been parsed by Parse().

func Parse

func Parse(expr cwl.Expression) []*Part

Parse parses a string into a list of parts. If the string does not contain a CWL expression, a single part is returned with `Raw` set to the original string and `Expr` set to an empty string.

Jump to

Keyboard shortcuts

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