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
  ccfe095d_b046_9c2c_9e32_6b444625187d["extractIdentifiers()"]
  ed6d52fa_60a9_2e8f_6c01_9292d24121d8["walkFunctionParams()"]
  ed6d52fa_60a9_2e8f_6c01_9292d24121d8 -->|calls| ccfe095d_b046_9c2c_9e32_6b444625187d
  ba00ad14_1a95_475e_df8a_aaa28d1487cc["walkBlockDeclarations()"]
  ba00ad14_1a95_475e_df8a_aaa28d1487cc -->|calls| ccfe095d_b046_9c2c_9e32_6b444625187d
  style ccfe095d_b046_9c2c_9e32_6b444625187d 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.
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