Unverified Commit 7cbe29eb authored by Ruben Bridgewater's avatar Ruben Bridgewater
Browse files

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: default avatarMichaël Zasso <targos@protonmail.com>
parent e68b0d6f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment