Skip to content

Commit

Permalink
lib: remove useless cwd in posix.resolve
Browse files Browse the repository at this point in the history
PR-URL: #23902
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
ZYSzys authored and danbev committed Oct 30, 2018
1 parent 8eb9eca commit b255cd4
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -1073,16 +1073,13 @@ const posix = {
resolve: function resolve() {
var resolvedPath = '';
var resolvedAbsolute = false;
var cwd;

for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path;
if (i >= 0)
path = arguments[i];
else {
if (cwd === undefined)

This comment has been minimized.

Copy link
@MylesBorins

MylesBorins Nov 27, 2018

Contributor

is it just me or was this done in order to cache cwd and avoid a call to process.cwd() on each iteration of the for loop?

This comment has been minimized.

Copy link
@MylesBorins

MylesBorins Nov 27, 2018

Contributor

nvm I see @cjihrig's response... my b

cwd = process.cwd();
path = cwd;
path = process.cwd();
}

assertPath(path);
Expand Down

0 comments on commit b255cd4

Please sign in to comment.