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

Function createInstrumentationGetter

packages/reactivity/src/collectionHandlers.ts:270–294  ·  view source on GitHub ↗
(isReadonly: boolean, shallow: boolean)

Source from the content-addressed store, hash-verified

268}
269
270function createInstrumentationGetter(isReadonly: boolean, shallow: boolean) {
271 const instrumentations = createInstrumentations(isReadonly, shallow)
272
273 return (
274 target: CollectionTypes,
275 key: string | symbol,
276 receiver: CollectionTypes,
277 ) => {
278 if (key === ReactiveFlags.IS_REACTIVE) {
279 return !isReadonly
280 } else if (key === ReactiveFlags.IS_READONLY) {
281 return isReadonly
282 } else if (key === ReactiveFlags.RAW) {
283 return target
284 }
285
286 return Reflect.get(
287 hasOwn(instrumentations, key) && key in target
288 ? instrumentations
289 : target,
290 key,
291 receiver,
292 )
293 }
294}
295
296export const mutableCollectionHandlers: ProxyHandler<CollectionTypes> = {
297 get: /*@__PURE__*/ createInstrumentationGetter(false, false),

Callers 1

Calls 3

hasOwnFunction · 0.90
createInstrumentationsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected