path: refactor for less indentation
This moves the `if (len === 1)` case to the top of the function. That way it is possible to reduce the indentation level due to returning early in that case. On top of that the following was done: 1) For clarity refactored for loops which were meant to count up a variable into a while loop. 2) Used template strings instead of string concat. 3) Consolidating nested if statements. 4) Using tenary expressions if applicable when assigning variables to reduce the code overhead. PR-URL: https://github.com/nodejs/node/pull/25278 Reviewed-By:Michaël Zasso <targos@protonmail.com>
parent
e68b0d6f
Please register or sign in to comment