Skip to content

Commit bc38d23

Browse files
chihebnabilDaniel15
authored andcommitted
Update api-reference.mdx with findImportDeclarations
1 parent b07b6c9 commit bc38d23

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

website/src/content/docs/build/api-reference.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ Finds nodes that match the provided type.
7171
const variableDeclarations = j.find(j.VariableDeclaration);
7272
```
7373

74+
### **`findImportDeclarations`**
75+
76+
Finds all ImportDeclarations optionally filtered by name.
77+
78+
**Parameters**: `sourcePath` (String).
79+
80+
**Example**:
81+
82+
```jsx
83+
const routerImports = j.findImportDeclarations('react-router-dom');
84+
85+
```
86+
7487
### **`closestScope`**
7588

7689
Finds the closest enclosing scope of a node. Useful for determining the scope context of variables and functions.

0 commit comments

Comments
 (0)