Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 21ec855

Browse filesBrowse files
mertcanaltinruyadorno
authored andcommitted
os: improve path check with direct index access
PR-URL: #55434 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
1 parent 3477b6b commit 21ec855
Copy full SHA for 21ec855

1 file changed

+2-3Lines changed: 2 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/os.js‎

Copy file name to clipboardExpand all lines: lib/os.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const {
2626
Float64Array,
2727
NumberParseInt,
2828
ObjectDefineProperties,
29-
StringPrototypeEndsWith,
3029
StringPrototypeSlice,
3130
SymbolToPrimitive,
3231
} = primordials;
@@ -184,9 +183,9 @@ function tmpdir() {
184183
process.env.TMP ||
185184
(process.env.SystemRoot || process.env.windir) + '\\temp';
186185

187-
if (path.length > 1 && StringPrototypeEndsWith(path, '\\') &&
188-
!StringPrototypeEndsWith(path, ':\\'))
186+
if (path.length > 1 && path[path.length - 1] === '\\' && path[path.length - 2] !== ':') {
189187
return StringPrototypeSlice(path, 0, -1);
188+
}
190189

191190
return path;
192191
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.