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

Function createPathGetter

packages/runtime-core/src/apiWatch.ts:270–282  ·  view source on GitHub ↗
(
  ctx: ComponentPublicInstance,
  path: string,
)

Source from the content-addressed store, hash-verified

268}
269
270export function createPathGetter(
271 ctx: ComponentPublicInstance,
272 path: string,
273): () => WatchSource | WatchSource[] | WatchEffect | object {
274 const segments = path.split('.')
275 return (): WatchSource | WatchSource[] | WatchEffect | object => {
276 let cur = ctx
277 for (let i = 0; i < segments.length && cur; i++) {
278 cur = cur[segments[i] as keyof typeof cur]
279 }
280 return cur
281 }
282}

Callers 2

createWatcherFunction · 0.90
instanceWatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected