MCPcopy Index your code
hub / github.com/expr-lang/expr / getLen

Function getLen

internal/testify/assert/assertions.go:782–788  ·  view source on GitHub ↗

getLen tries to get the length of an object. It returns (0, false) if impossible.

(x interface{})

Source from the content-addressed store, hash-verified

780// getLen tries to get the length of an object.
781// It returns (0, false) if impossible.
782func getLen(x interface{}) (length int, ok bool) {
783 v := reflect.ValueOf(x)
784 defer func() {
785 ok = recover() == nil
786 }()
787 return v.Len(), true
788}
789
790// Len asserts that the specified object has specific length.
791// Len also fails if the object has a type that len() not accept.

Callers 2

Test_getLenFunction · 0.85
LenFunction · 0.85

Calls 1

LenMethod · 0.45

Tested by 1

Test_getLenFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…