path: refactor for less indentation
This just switches the statements in a way that it reduces the overall indentation. The function has a very deep indentation in general and this should improve the readability. PR-URL: https://github.com/nodejs/node/pull/26917 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
f7c96856f9
commit
dd0d6df9ae
12
lib/path.js
12
lib/path.js
@ -165,8 +165,13 @@ const win32 = {
|
||||
const code = path.charCodeAt(0);
|
||||
|
||||
// Try to match a root
|
||||
if (len > 1) {
|
||||
if (len === 1) {
|
||||
if (isPathSeparator(code)) {
|
||||
// `path` contains just a path separator
|
||||
rootEnd = 1;
|
||||
isAbsolute = true;
|
||||
}
|
||||
} else if (isPathSeparator(code)) {
|
||||
// Possible UNC root
|
||||
|
||||
// If we started with a separator, we know we at least have an
|
||||
@ -218,11 +223,6 @@ const win32 = {
|
||||
rootEnd = 3;
|
||||
}
|
||||
}
|
||||
} else if (isPathSeparator(code)) {
|
||||
// `path` contains just a path separator
|
||||
rootEnd = 1;
|
||||
isAbsolute = true;
|
||||
}
|
||||
|
||||
if (device.length > 0) {
|
||||
if (resolvedDevice.length > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user