MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Lists

Function Lists

ext/lists.go:155–161  ·  view source on GitHub ↗

Lists returns a cel.EnvOption to configure extended functions for list manipulation. As a general note, all indices are zero-based. # Distinct Introduced in version: 2 (cost support in version 3) Returns the distinct elements of a list. .distinct() -> Examples: [1, 2, 2, 3

(options ...ListsOption)

Source from the content-addressed store, hash-verified

153// ].sortBy(e, e.score).map(e, e.name)
154// == ["bar", "foo", "baz"]
155func Lists(options ...ListsOption) cel.EnvOption {
156 l := &listsLib{version: math.MaxUint32, maxRangeSize: defaultMaxRangeSize}
157 for _, o := range options {
158 l = o(l)
159 }
160 return cel.Lib(l)
161}
162
163const defaultMaxRangeSize = 1_000_000
164

Callers 6

evaluator.goFile · 0.92
TestListsRuntimeErrorsFunction · 0.85
TestListsVersionFunction · 0.85
testListsEnvFunction · 0.85
testCompreEnvFunction · 0.85

Calls 1

LibFunction · 0.92

Tested by 4

TestListsRuntimeErrorsFunction · 0.68
TestListsVersionFunction · 0.68
testListsEnvFunction · 0.68
testCompreEnvFunction · 0.68