Documentation
    Preparing search index...
    • Finds an import reference inside a code snippet by analyzing the import statements and matching against the provided import reference identifier.

      The function searches through all import statements in the code and matches against default, namespace, or named imports based on the import reference.

      Parameters

      • code: string

        The code snippet to search for imports

      • importReference: string

        The import reference identifier to find (can include dot notation)

      Returns Promise<null | Import>

      Promise that resolves to an Import object or null if not found

      const importInfo = await findImport(code, 'validateUser')
      if (importInfo) {
      console.log(importInfo.specifier) // '@/validators/user'
      }