Skip to content

Commit c9c847c

Browse files
authored
Merge pull request #123 from MalathiBalaraman31/docs/improve-readme
docs: shorten resolveFromCwd JSDoc
2 parents 8589381 + c7b43a7 commit c9c847c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/core/helpers/resolveFromCwd.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import path from 'path';
22

33
/**
4-
* Resolves a path relative to the current working directory.
5-
* @param cwd - Current working directory
6-
* @param p - Path to resolve
7-
* @returns Resolved absolute path
4+
* Resolves a filesystem path relative to a given current working directory (CWD).
5+
*
6+
* This helper is useful when working with user-provided paths that may be
7+
* relative or absolute.
8+
*
9+
* - Absolute paths are returned unchanged.
10+
* - Relative paths are resolved against `cwd` using `path.resolve`.
11+
*
12+
* @param cwd - Base directory used to resolve relative paths
13+
* @param p - A relative or absolute filesystem path
14+
* @returns An absolute filesystem path
815
*/
916
export const resolveFromCwd = (cwd: string, p: string): string =>
1017
path.isAbsolute(p) ? p : path.resolve(cwd, p);

0 commit comments

Comments
 (0)