MCPcopy Create free account
hub / github.com/expr-lang/expr / Len

Function Len

vm/runtime/runtime.go:266–274  ·  view source on GitHub ↗
(a any)

Source from the content-addressed store, hash-verified

264}
265
266func Len(a any) int {
267 v := reflect.ValueOf(a)
268 switch v.Kind() {
269 case reflect.Array, reflect.Slice, reflect.Map, reflect.String:
270 return v.Len()
271 default:
272 panic(fmt.Sprintf("invalid argument for len (type %T)", a))
273 }
274}
275
276func Negate(i any) any {
277 switch v := i.(type) {

Callers 1

RunMethod · 0.92

Calls 2

SprintfMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected