MCPcopy Create free account
hub / github.com/gavv/httpexpect / Iter

Method Iter

object.go:364–384  ·  view source on GitHub ↗

Iter returns a new map of Values attached to object elements. Example: numbers := map[string]interface{}{"foo": 123, "bar": 456} object := NewObject(t, numbers) for key, value := range object.Iter() { value.Number().IsEqual(numbers[key]) }

()

Source from the content-addressed store, hash-verified

362// value.Number().IsEqual(numbers[key])
363// }
364func (o *Object) Iter() map[string]Value {
365 opChain := o.chain.enter("Iter()")
366 defer opChain.leave()
367
368 if opChain.failed() {
369 return map[string]Value{}
370 }
371
372 ret := map[string]Value{}
373
374 for k, v := range o.value {
375 func() {
376 valueChain := opChain.replace("Iter[%q]", k)
377 defer valueChain.leave()
378
379 ret[k] = *newValue(valueChain, v)
380 }()
381 }
382
383 return ret
384}
385
386// Every runs the passed function for all the key value pairs in the object.
387//

Callers 1

TestObject_IterFunction · 0.95

Calls 5

newValueFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
replaceMethod · 0.80

Tested by 1

TestObject_IterFunction · 0.76