Skip to content

Commit

Permalink
fix: fix the docs for replaceExt
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Aug 19, 2022
1 parent f8cc2cb commit bb2d787
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- [`name` (function)](#name-function)
- [`normalizeTrim` (function)](#normalizetrim-function)
- [`removeExt` (function)](#removeext-function)
- [`replaceExt` (variable)](#replaceext-variable)
- [`replaceExt` (function)](#replaceext-function)
- [🤝 Contributing](#contributing)

<!-- /code_chunk_output -->
Expand Down Expand Up @@ -209,16 +209,18 @@ import { removeExt } from "patha"
removeExt("some/dir/file.ext") // gives "some/dir/file"
```

### `replaceExt` (variable)
### `replaceExt` (function)

Replaces the extension from path with extension and returns the updated path string.

Does not replace the extension if path is not a string or is empty.

**Parameters:**

- path - The given path
- extension - The extension to replace
- path (`string`) - The given path
- extension (`string`) - The extension to replace

**returns:** any

```js
import { replaceExt } from "patha"
Expand Down
8 changes: 4 additions & 4 deletions src/replace-ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import replaceExtOrig from "replace-ext"
* @param path The given path
* @param extension The extension to replace
*/

export const replaceExt = replaceExtOrig

// TODO replaceExt should not change `/` to `\\` on Windows
export function replaceExt(path: string, extension: string) {
// TODO replaceExt should not change `/` to `\\` on Windows
return replaceExtOrig(path, extension)
}

0 comments on commit bb2d787

Please sign in to comment.