Skip to content

Commit daeb6fc

Browse files
VoltrexKeyvatargos
authored andcommitted
path: inline conditions
This condition can be inlined in the first `if` statement since if the `path`'s length is 0, it'll be a empty string so we can return that as there's no need for an extra `if` statement. PR-URL: #38613 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent c4e7dca commit daeb6fc

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/path.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,9 @@ const win32 = {
608608

609609
toNamespacedPath(path) {
610610
// Note: this will *probably* throw somewhere.
611-
if (typeof path !== 'string')
611+
if (typeof path !== 'string' || path.length === 0)
612612
return path;
613613

614-
if (path.length === 0) {
615-
return '';
616-
}
617-
618614
const resolvedPath = win32.resolve(path);
619615

620616
if (resolvedPath.length <= 2)

0 commit comments

Comments
 (0)