GeezerVison is showing github.com — path: remove `StringPrototypeCharCodeAt` from `posix.extname` · nodejs/node@309cb1c
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/path.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1463,8 +1463,8 @@ const posix = { |
1463 | 1463 | // after any path separator we find |
1464 | 1464 | let preDotState = 0; |
1465 | 1465 | for (let i = path.length - 1; i >= 0; --i) { |
1466 | | - const code = StringPrototypeCharCodeAt(path, i); |
1467 | | - if (code === CHAR_FORWARD_SLASH) { |
| 1466 | + const char = path[i]; |
| 1467 | + if (char === '/') { |
1468 | 1468 | // If we reached a path separator that was not part of a set of path |
1469 | 1469 | // separators at the end of the string, stop now |
1470 | 1470 | if (!matchedSlash) { |
@@ -1479,7 +1479,7 @@ const posix = { |
1479 | 1479 | matchedSlash = false; |
1480 | 1480 | end = i + 1; |
1481 | 1481 | } |
1482 | | - if (code === CHAR_DOT) { |
| 1482 | + if (char === '.') { |
1483 | 1483 | // If this is our first dot, mark it as the start of our extension |
1484 | 1484 | if (startDot === -1) |
1485 | 1485 | startDot = i; |
|