File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 11import 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 */
916export const resolveFromCwd = ( cwd : string , p : string ) : string =>
1017 path . isAbsolute ( p ) ? p : path . resolve ( cwd , p ) ;
You can’t perform that action at this time.
0 commit comments