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

Function findProp

packages/compiler-core/src/utils.ts:300–321  ·  view source on GitHub ↗
(
  node: ElementNode,
  name: string,
  dynamicOnly: boolean = false,
  allowEmpty: boolean = false,
)

Source from the content-addressed store, hash-verified

298}
299
300export function findProp(
301 node: ElementNode,
302 name: string,
303 dynamicOnly: boolean = false,
304 allowEmpty: boolean = false,
305): ElementNode['props'][0] | undefined {
306 for (let i = 0; i < node.props.length; i++) {
307 const p = node.props[i]
308 if (p.type === NodeTypes.ATTRIBUTE) {
309 if (dynamicOnly) continue
310 if (p.name === name && (p.value || allowEmpty)) {
311 return p
312 }
313 } else if (
314 p.name === 'bind' &&
315 (p.exp || allowEmpty) &&
316 isStaticArgOf(p.arg, name)
317 ) {
318 return p
319 }
320 }
321}
322
323export function isStaticArgOf(
324 arg: DirectiveNode['arg'],

Callers 10

transformModelFunction · 0.90
createIfBranchFunction · 0.90
vFor.tsFile · 0.90
resolveComponentTypeFunction · 0.90
ssrProcessTeleportFunction · 0.85
checkDuplicatedValueFunction · 0.85
ssrTransformModelFunction · 0.85
findValueBindingFunction · 0.85
ssrTransformTransitionFunction · 0.85

Calls 1

isStaticArgOfFunction · 0.85

Tested by

no test coverage detected