镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
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 number Diff line number Diff 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 Down Expand 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 Down Expand 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