MCPcopy
hub / github.com/flosch/pongo2 / ApplyFilter

Function ApplyFilter

filters.go:54–69  ·  view source on GitHub ↗

ApplyFilter applies a filter to a given value using the given parameters. Returns a *pongo2.Value or an error.

(name string, value *Value, param *Value)

Source from the content-addressed store, hash-verified

52// ApplyFilter applies a filter to a given value using the given parameters.
53// Returns a *pongo2.Value or an error.
54func ApplyFilter(name string, value *Value, param *Value) (*Value, *Error) {
55 fn, existing := filters[name]
56 if !existing {
57 return nil, &Error{
58 Sender: "applyfilter",
59 OrigError: fmt.Errorf("filter with name '%s' not found", name),
60 }
61 }
62
63 // Make sure param is a *Value
64 if param == nil {
65 param = AsValue(nil)
66 }
67
68 return fn(value, param)
69}
70
71type filterCall struct {
72 token *Token

Callers 4

MustApplyFilterFunction · 0.85
ExecuteMethod · 0.85
ExecuteMethod · 0.85
filterUrlizeHelperFunction · 0.85

Calls 1

AsValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…