Skip to content

Commit ec96ae7

Browse files
committed
path: join refactor
1 parent c6822be commit ec96ae7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/path.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,20 +368,19 @@ const win32 = {
368368
if (args.length === 0)
369369
return '.';
370370

371-
let joined;
372-
let firstPart;
373-
for (let i = 0; i < args.length; ++i) {
374-
const arg = args[i];
371+
let joined = null;
372+
let firstPart = null;
373+
for (const arg of args) {
375374
validateString(arg, 'path');
376375
if (arg.length > 0) {
377-
if (joined === undefined)
376+
if (joined === null)
378377
joined = firstPart = arg;
379378
else
380379
joined += `\\${arg}`;
381380
}
382381
}
383382

384-
if (joined === undefined)
383+
if (joined === null)
385384
return '.';
386385

387386
// Make sure that the joined path doesn't start with two slashes, because

0 commit comments

Comments
 (0)