Skip to content

Commit 6ab59c8

Browse files
mertcanaltinaduh95
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 0302efe commit 6ab59c8

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎lib/os.js‎

Lines 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
returnStringPrototypeSlice(path,0,-1);
188+
}
190189

191190
returnpath;
192191
}

0 commit comments

Comments
 (0)