Skip to content

Commit

Permalink
chore: add an example for addShRelativePrefix [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Aug 19, 2022
1 parent 5abb33c commit 4127cd1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ Prefix a `./` for unix shell and nothing for `cmd`.

**returns:** string

```js
import { addShRelativePrefix } from "patha"

addShRelativePrefix("some/file-name") // gives "some/file-name" on Windows and "./some/file-name" on others.
```

### `name` (function)

Get the name of the given file path.
Expand Down Expand Up @@ -206,6 +212,7 @@ Remove a path's extension.

```js
import { removeExt } from "patha"

removeExt("some/dir/file.ext") // gives "some/dir/file"
```

Expand Down
8 changes: 8 additions & 0 deletions src/add-sh-relative-prefix.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
/**
* Prefix a `./` for unix shell and nothing for `cmd`.
*
* @example
*
* ```js
* import { addShRelativePrefix } from "patha"
*
* addShRelativePrefix("some/file-name") // gives "some/file-name" on Windows and "./some/file-name" on others.
* ```
*
* @param path The given path
* @returns The path with `./` added on Unix
*/
Expand Down
1 change: 1 addition & 0 deletions src/remove-ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { extname } from "path"
*
* ```js
* import { removeExt } from "patha"
*
* removeExt("some/dir/file.ext") // gives "some/dir/file"
* ```
*
Expand Down

0 comments on commit 4127cd1

Please sign in to comment.