Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,21 +506,20 @@
if (args.length === 0)
return '.';

let joined;
let firstPart;
const path = [];
for (let i = 0; i < args.length; ++i) {
const arg = args[i];
validateString(arg, 'path');
if (arg.length > 0) {
if (joined === undefined)
joined = firstPart = arg;
else
joined += `\\${arg}`;
path.push(arg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
path.push(arg);
ArrayPrototypePush(path, arg);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review!
f1f2e05

}
}

if (joined === undefined)
if (path.length === 0)
return '.';

Check failure on line 520 in lib/path.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Trailing spaces not allowed
const firstPart = path[0];
let joined = ArrayPrototypeJoin(path, '\\');

// Make sure that the joined path doesn't start with two slashes, because
// normalize() will mistake it for a UNC path then.
Expand Down
Loading