diff --git a/lib/os.js b/lib/os.js index c88ef443b9b4f2..c6e2f220fd223b 100644 --- a/lib/os.js +++ b/lib/os.js @@ -26,7 +26,6 @@ const { Float64Array, NumberParseInt, ObjectDefineProperties, - StringPrototypeEndsWith, StringPrototypeSlice, SymbolToPrimitive, } = primordials; @@ -184,9 +183,9 @@ function tmpdir() { process.env.TMP || (process.env.SystemRoot || process.env.windir) + '\\temp'; - if (path.length > 1 && StringPrototypeEndsWith(path, '\\') && - !StringPrototypeEndsWith(path, ':\\')) + if (path.length > 1 && path[path.length - 1] === '\\' && path[path.length - 2] !== ':') { return StringPrototypeSlice(path, 0, -1); + } return path; }