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 RafaelGSS committed Aug 19, 2024
1 parent 66dcb2a commit 9aec536
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 @@ -1236,20 +1236,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 9aec536

Please sign in to comment.