MCPcopy Index your code
hub / github.com/gavv/httpexpect / Length

Method Length

array.go:142–151  ·  view source on GitHub ↗

Length returns a new Number instance with array length. Example: array := NewArray(t, []interface{}{1, 2, 3}) array.Length().IsEqual(3)

()

Source from the content-addressed store, hash-verified

140// array := NewArray(t, []interface{}{1, 2, 3})
141// array.Length().IsEqual(3)
142func (a *Array) Length() *Number {
143 opChain := a.chain.enter("Length()")
144 defer opChain.leave()
145
146 if opChain.failed() {
147 return newNumber(opChain, 0)
148 }
149
150 return newNumber(opChain, float64(len(a.value)))
151}
152
153// Value returns a new Value instance with array element for given index.
154//

Callers 1

TestArray_GettersFunction · 0.95

Calls 4

newNumberFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80

Tested by 1

TestArray_GettersFunction · 0.76