Joins multiple path segments into a single path string.
Intelligently handles slashes between segments, avoiding duplicates while ensuring proper separation. Empty segments are skipped.
Path segments to join
Joined path string
pathJoin('/home', 'user', 'docs');// '/home/user/docs'pathJoin('/api/', '/users/', 'profile');// '/api//users/profile'pathJoin('src', 'utils', 'path.ts');// 'src/utils/path.ts' Copy
pathJoin('/home', 'user', 'docs');// '/home/user/docs'pathJoin('/api/', '/users/', 'profile');// '/api//users/profile'pathJoin('src', 'utils', 'path.ts');// 'src/utils/path.ts'
Joins multiple path segments into a single path string.
Intelligently handles slashes between segments, avoiding duplicates while ensuring proper separation. Empty segments are skipped.