MCPcopy
hub / github.com/vuejs/core / forEach

Function forEach

packages/reactivity/src/collectionHandlers.ts:144–156  ·  view source on GitHub ↗
(this: IterableCollections, callback: Function, thisArg?: unknown)

Source from the content-addressed store, hash-verified

142 : target.has(key) || target.has(rawKey)
143 },
144 forEach(this: IterableCollections, callback: Function, thisArg?: unknown) {
145 const observed = this
146 const target = observed[ReactiveFlags.RAW]
147 const rawTarget = toRaw(target)
148 const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive
149 !readonly && track(rawTarget, TrackOpTypes.ITERATE, ITERATE_KEY)
150 return target.forEach((value: unknown, key: unknown) => {
151 // important: make sure the callback is
152 // 1. invoked with the reactive map as `this` and 3rd arg
153 // 2. the value received should be a corresponding reactive/readonly.
154 return callback.call(thisArg, wrap(value), wrap(key), observed)
155 })
156 },
157 }
158
159 extend(

Callers 3

hydrateOnVisibleFunction · 0.50
teardownFunction · 0.50
hydrateOnInteractionFunction · 0.50

Calls 3

toRawFunction · 0.90
trackFunction · 0.90
forEachMethod · 0.80

Tested by

no test coverage detected