Skip to content

Commit

Permalink
Update the documentation [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Jan 26, 2024
1 parent 3c2ae03 commit 91ed041
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ npm install @cedx/which
### 2. Import it
Now in your [JavaScript](https://developer.mozilla.org/docs/Web/JavaScript) code, you can use:

```javascript
```js
import which from "@cedx/which";
```
10 changes: 5 additions & 5 deletions docs/usage/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This function takes the name of the command to locate, and returns a `ResultSet`
The `ResultSet.all()` method returns a `Promise` that resolves with the absolute paths of all instances of an executable found in the system path.
If the executable could not be located, the promise rejects.

```javascript
```js
import console from "node:console";
import which from "@cedx/which";

Expand All @@ -29,7 +29,7 @@ catch (error) {
The `ResultSet.first()` method returns a `Promise` that resolves with the absolute path of the first instance of an executable found in the system path.
If the executable could not be located, the promise rejects.

```javascript
```js
import console from "node:console";
import which from "@cedx/which";

Expand All @@ -45,7 +45,7 @@ catch (error) {
### **stream()**: AsyncGenerator<string>
The `ResultSet.stream()` method returns an asynchronous generator that yields the absolute path of the instances of an executable found in the system path.

```javascript
```js
import console from "node:console";
import which from "@cedx/which";

Expand All @@ -65,7 +65,7 @@ The behavior of the `which(command: string, options?: FinderOptions)` function c
An array of strings specifying the list of executable file extensions.
On Windows, defaults to the list of extensions provided by the `PATHEXT` environment variable.

```javascript
```js
which("foobar", {extensions: [".foo", ".exe", ".cmd"]});
```

Expand All @@ -75,6 +75,6 @@ which("foobar", {extensions: [".foo", ".exe", ".cmd"]});
An array of strings specifying the system paths from which the given command will be searched.
Defaults to the list of directories provided by the `PATH` environment variable.

```javascript
```js
which("foobar", {paths: ["/usr/local/bin", "/usr/bin"]});
```

0 comments on commit 91ed041

Please sign in to comment.