Skip to content
Open
Changes from all commits
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
15 changes: 6 additions & 9 deletions lib/path.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -1262,8 +1262,7 @@ const posix = {
}

resolvedPath = `${path}/${resolvedPath}`;
resolvedAbsolute =
StringPrototypeCharCodeAt(path, 0) === CHAR_FORWARD_SLASH;
resolvedAbsolute = path[0] === '/';
}

if (!resolvedAbsolute) {
Expand DownExpand Up@@ -1296,10 +1295,8 @@ const posix = {
if (path.length === 0)
return '.';

const isAbsolute =
StringPrototypeCharCodeAt(path, 0) === CHAR_FORWARD_SLASH;
const trailingSeparator =
StringPrototypeCharCodeAt(path, path.length - 1) === CHAR_FORWARD_SLASH;
const isAbsolute = path[0] === '/';
const trailingSeparator = path[path.length - 1] === '/';

// Normalize the path
path = normalizeString(path, !isAbsolute, '/', isPosixPathSeparator);
Expand DownExpand Up@@ -1639,8 +1636,8 @@ const posix = {

// Get non-dir info
for (; i >= start; --i) {
const code = StringPrototypeCharCodeAt(path, i);
if (code === CHAR_FORWARD_SLASH) {
const char = path[i];
if (char === '/') {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
Expand All@@ -1655,7 +1652,7 @@ const posix = {
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
if (char === '.') {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1)
startDot = i;
Expand Down
Loading