GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — path: change `posix.join` to use array · nodejs/node@9aec536

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • path.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/path.js‎

Copy file name to clipboardExpand all lines: lib/path.js
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,20 +1236,20 @@ const posix = {
12361236
join(...args) {
12371237
if (args.length === 0)
12381238
return '.';
1239-
let joined;
1239+
1240+
const path = [];
12401241
for (let i = 0; i < args.length; ++i) {
12411242
const arg = args[i];
12421243
validateString(arg, 'path');
12431244
if (arg.length > 0) {
1244-
if (joined === undefined)
1245-
joined = arg;
1246-
else
1247-
joined += `/${arg}`;
1245+
path.push(arg);
12481246
}
12491247
}
1250-
if (joined === undefined)
1248+
1249+
if (path.length === 0)
12511250
return '.';
1252-
return posix.normalize(joined);
1251+
1252+
return posix.normalize(ArrayPrototypeJoin(path, '/'));
12531253
},
12541254

12551255
/**

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.