MCPcopy Create free account
hub / github.com/dop251/goja / arrayproto_every

Method arrayproto_every

builtin_array.go:719–738  ·  view source on GitHub ↗
(call FunctionCall)

Source from the content-addressed store, hash-verified

717}
718
719func (r *Runtime) arrayproto_every(call FunctionCall) Value {
720 o := call.This.ToObject(r)
721 length := toLength(o.self.getStr("length", nil))
722 callbackFn := r.toCallable(call.Argument(0))
723 fc := FunctionCall{
724 This: call.Argument(1),
725 Arguments: []Value{nil, nil, o},
726 }
727 for k := int64(0); k < length; k++ {
728 idx := valueInt(k)
729 if val := o.self.getIdx(idx, nil); val != nil {
730 fc.Arguments[0] = val
731 fc.Arguments[1] = idx
732 if !callbackFn(fc).ToBoolean() {
733 return valueFalse
734 }
735 }
736 }
737 return valueTrue
738}
739
740func (r *Runtime) arrayproto_some(call FunctionCall) Value {
741 o := call.This.ToObject(r)

Callers

nothing calls this directly

Calls 8

toCallableMethod · 0.95
toLengthFunction · 0.85
valueIntTypeAlias · 0.85
ToObjectMethod · 0.65
getStrMethod · 0.65
getIdxMethod · 0.65
ToBooleanMethod · 0.65
ArgumentMethod · 0.45

Tested by

no test coverage detected