diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 16:27:06 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 16:27:06 +0800 |
| commit | 2db6defc0b555d93d2363ba6c6dfa19df7dc7c11 (patch) | |
| tree | a92c596973b150bbd1723b55facf38e0ab6258d8 /node_modules/slash/index.js | |
| parent | 6dce4e2e8ed35a26af389b7ab388113381350444 (diff) | |
update
Diffstat (limited to 'node_modules/slash/index.js')
| -rw-r--r-- | node_modules/slash/index.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/node_modules/slash/index.js b/node_modules/slash/index.js index 1b7ee1ed..75d72501 100644 --- a/node_modules/slash/index.js +++ b/node_modules/slash/index.js @@ -1,9 +1,11 @@ -export default function slash(path) { - const isExtendedLengthPath = path.startsWith('\\\\?\\'); +'use strict'; +module.exports = input => { + const isExtendedLengthPath = /^\\\\\?\\/.test(input); + const hasNonAscii = /[^\u0000-\u0080]+/.test(input); // eslint-disable-line no-control-regex - if (isExtendedLengthPath) { - return path; + if (isExtendedLengthPath || hasNonAscii) { + return input; } - return path.replace(/\\/g, '/'); -} + return input.replace(/\\/g, '/'); +}; |
