diff --git a/README.md b/README.md index d966e2a..bf3d365 100644 --- a/README.md +++ b/README.md @@ -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) @@ -209,7 +209,7 @@ 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. @@ -217,8 +217,10 @@ 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" diff --git a/src/replace-ext.ts b/src/replace-ext.ts index b7c20af..a0178f6 100644 --- a/src/replace-ext.ts +++ b/src/replace-ext.ts @@ -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) +}