Home / Function/ extractIdentifiers() — vue Function Reference

extractIdentifiers() — vue Function Reference

Architecture documentation for the extractIdentifiers() function in babelUtils.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  4c627be7_6323_9d1a_49bc_0a2a140978c0["extractIdentifiers()"]
  946e0fa6_6c05_b820_0bd7_980d6d869192["babelUtils.ts"]
  4c627be7_6323_9d1a_49bc_0a2a140978c0 -->|defined in| 946e0fa6_6c05_b820_0bd7_980d6d869192
  414e5246_5f40_b96a_8130_5a96cb9d8426["walkFunctionParams()"]
  414e5246_5f40_b96a_8130_5a96cb9d8426 -->|calls| 4c627be7_6323_9d1a_49bc_0a2a140978c0
  5e4207f6_76c5_de5d_945f_5dc740607887["walkBlockDeclarations()"]
  5e4207f6_76c5_de5d_945f_5dc740607887 -->|calls| 4c627be7_6323_9d1a_49bc_0a2a140978c0
  style 4c627be7_6323_9d1a_49bc_0a2a140978c0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/compiler-sfc/src/babelUtils.ts lines 173–216

export function extractIdentifiers(
  param: Node,
  nodes: Identifier[] = []
): Identifier[] {
  switch (param.type) {
    case 'Identifier':
      nodes.push(param)
      break

    case 'MemberExpression':
      let object: any = param
      while (object.type === 'MemberExpression') {
        object = object.object
      }
      nodes.push(object)
      break

    case 'ObjectPattern':
      for (const prop of param.properties) {
        if (prop.type === 'RestElement') {
          extractIdentifiers(prop.argument, nodes)
        } else {
          extractIdentifiers(prop.value, nodes)
        }
      }
      break

    case 'ArrayPattern':
      param.elements.forEach(element => {
        if (element) extractIdentifiers(element, nodes)
      })
      break

    case 'RestElement':
      extractIdentifiers(param.argument, nodes)
      break

    case 'AssignmentPattern':
      extractIdentifiers(param.left, nodes)
      break
  }

  return nodes
}

Domain

Subdomains

Frequently Asked Questions

What does extractIdentifiers() do?
extractIdentifiers() is a function in the vue codebase, defined in packages/compiler-sfc/src/babelUtils.ts.
Where is extractIdentifiers() defined?
extractIdentifiers() is defined in packages/compiler-sfc/src/babelUtils.ts at line 173.
What calls extractIdentifiers()?
extractIdentifiers() is called by 2 function(s): walkBlockDeclarations, walkFunctionParams.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free