UNPKG
@planjs/utils
Version:
latest (1.18.4)
1.18.4
1.18.3
1.18.2
1.18.1
1.18.0
1.17.1
1.17.0
1.16.0
1.15.15
1.15.14
1.15.13
1.15.12
1.15.11
1.15.10
1.15.9
1.15.8
1.15.7
1.15.6
1.15.5
1.15.4
1.15.3
1.15.2
1.15.1
1.15.0
1.14.0
1.13.2
1.13.1
1.13.0
1.12.0
1.11.7
1.11.6
1.11.5
1.11.4
1.11.3
1.11.2
1.11.1
1.11.0
1.10.0
1.9.3
1.9.2
1.9.1
1.9.0
1.8.4
1.8.3
1.8.2
1.8.1
1.8.0
1.7.3
1.7.2
1.7.1
1.7.0
1.6.1
1.6.0
1.5.1
1.5.0
1.4.0
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.0
1.1.2
1.1.1
1.1.0
1.0.40
1.0.39
1.0.38
1.0.37
1.0.36
1.0.35
1.0.34
1.0.33
1.0.32
1.0.31
1.0.30
1.0.29
1.0.28
1.0.27
1.0.26
1.0.25
1.0.24
1.0.23
1.0.22
1.0.21
1.0.20
1.0.19
1.0.18
1.0.17
1.0.15
1.0.14
1.0.13
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.1
1.0.0
🔧 Common tools collection
planjs.github.io/utils/
planjs/utils
@planjs/utils
/
es
/
things
/
slash.js
15 lines
(12 loc)
•
279 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/** * 接受Windows反斜杠路径,并返回带有正斜杠的路径 *
@param
path
*/
function
slash
(
path
) {
var
isExtendedLengthPath =
/^\\\\\?\\/
.
test
(path);
if
(isExtendedLengthPath) {
return
path; }
return
path.
replace
(
/\\/g
,
'/'
); }
export
default
slash;