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:
Ruben Bridgewater 2019-03-26 07:18:17 +01:00
parent f7c96856f9
commit dd0d6df9ae
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -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) {