UNPKG
slash
Version:
latest (5.1.0)
5.1.0
5.0.1
5.0.0
4.0.0
3.0.0
2.0.0
1.0.0
0.1.3
0.1.1
0.1.0
Convert Windows backslash paths to slash paths
github.com/sindresorhus/slash
sindresorhus/slash
slash
/
index.js
10 lines
(7 loc)
•
181 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
export
default
function
slash
(
path
) {
const
isExtendedLengthPath = path.
startsWith
(
'\\\\?\\'
);
if
(isExtendedLengthPath) {
return
path; }
return
path.
replace
(
/\\/g
,
'/'
); }