Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path: inline conditions #38613

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions lib/path.js
Expand Up @@ -617,13 +617,9 @@ const win32 = {
*/
toNamespacedPath(path) {
// Note: this will *probably* throw somewhere.
if (typeof path !== 'string')
if (typeof path !== 'string' || path.length === 0)
return path;

if (path.length === 0) {
return '';
}

const resolvedPath = win32.resolve(path);

if (resolvedPath.length <= 2)
Expand Down