MCPcopy
hub / github.com/TanStack/query / findImportIdentifierOf

Function findImportIdentifierOf

packages/query-codemods/src/utils/index.cjs:2–12  ·  view source on GitHub ↗
(importSpecifiers, identifier)

Source from the content-addressed store, hash-verified

1module.exports = ({ root, jscodeshift }) => {
2 const findImportIdentifierOf = (importSpecifiers, identifier) => {
3 const specifier = importSpecifiers
4 .filter((node) => node.value.imported.name === identifier)
5 .paths()
6
7 if (specifier.length > 0) {
8 return specifier[0].value.local
9 }
10
11 return jscodeshift.identifier(identifier)
12 }
13
14 const findImportSpecifiers = (packageName) =>
15 root

Callers 1

locateImportsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…