Skip to content

Commit 2187ed1

Browse files
docs: add brief context to resolveFromCwd JSDoc
1 parent 68bc2e4 commit 2187ed1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/core/helpers/resolveFromCwd.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +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);
11-

0 commit comments

Comments
 (0)