Skip to content

Commit

Permalink
docs: update getVariableDeclarators description
Browse files Browse the repository at this point in the history
  • Loading branch information
morinokami authored and Daniel15 committed Jul 15, 2024
1 parent 0994ad8 commit aa324da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions website/src/content/docs/build/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ const closestFunction = j.find(j.Identifier).closest(j.FunctionDeclaration);

### **`getVariableDeclarators`**

Retrieves variable declarators with the specified name from the current collection.
Retrieves variable declarators from the current collection. If the callback function returns a falsy value, the element is not included in the result.

**Parameters**:`name` (String): The name of the variable to find.
**Parameters**:`callback` (Function): A function that returns the name of the variable to find.

**Example**:

```jsx
const variableDeclarators = j.getVariableDeclarators('myVariable');
const variableDeclarators = j.find(j.Identifier).getVariableDeclarators(path => path.value.name);
```

### **`findVariableDeclarators` ([source](https://github.com/facebook/jscodeshift/blob/main/src/collections/VariableDeclarator.js))**
Expand Down

0 comments on commit aa324da

Please sign in to comment.