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

Function instrumentArr

packages/reactivity/__tests__/reactiveArray.spec.ts:97–106  ·  view source on GitHub ↗
(rawTarget: any[])

Source from the content-addressed store, hash-verified

95 const identityMethods = ['includes', 'indexOf', 'lastIndexOf'] as const
96
97 function instrumentArr(rawTarget: any[]) {
98 const mutableTarget = rawTarget as Record<
99 (typeof identityMethods)[number],
100 any
101 >
102 identityMethods.forEach(key => {
103 const spy = vi.fn(rawTarget[key] as any)
104 mutableTarget[key] = spy
105 })
106 }
107
108 function searchValue(target: any[], ...args: unknown[]) {
109 return identityMethods.map(key => (target[key] as any)(...args))

Callers 1

Calls 1

forEachMethod · 0.80

Tested by

no test coverage detected