Skip to content

Commit

Permalink
path: change posix.join to use array
Browse files Browse the repository at this point in the history
Change posix.join to use array.join instead of additional assignment.

PR-URL: #54331
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
HBSPS authored and targos committed Oct 2, 2024
1 parent fcf82ad commit 2859b4b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -1237,20 +1237,20 @@ const posix = {
join(...args) {
if (args.length === 0)
return '.';
let joined;

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 = arg;
else
joined += `/${arg}`;
path.push(arg);
}
}
if (joined === undefined)

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

return posix.normalize(ArrayPrototypeJoin(path, '/'));
},

/**
Expand Down

0 comments on commit 2859b4b

Please sign in to comment.