mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
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> Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
This commit is contained in:
parent
a318cbcec0
commit
addc73af5c
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…
Reference in New Issue
Block a user