MCPcopy Create free account
hub / github.com/drone/envsubst / Eval

Function Eval

eval.go:6–12  ·  view source on GitHub ↗

Eval replaces ${var} in the string based on the mapping function.

(s string, mapping func(string) string)

Source from the content-addressed store, hash-verified

4
5// Eval replaces ${var} in the string based on the mapping function.
6func Eval(s string, mapping func(string) string) (string, error) {
7 t, err := Parse(s)
8 if err != nil {
9 return s, err
10 }
11 return t.Execute(mapping)
12}
13
14// EvalEnv replaces ${var} in the string according to the values of the
15// current environment variables. References to undefined variables are

Callers 2

TestExpandFunction · 0.85
EvalEnvFunction · 0.85

Calls 2

ExecuteMethod · 0.80
ParseFunction · 0.70

Tested by 1

TestExpandFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…