repo.or.cz
/
gitter.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git]
/
modules
/
uri-resolver
/
lib
/
normalise-uri.js
blob
cceb8a6d9f046b6fd78c140e9563c08afa4398f9
1
'use strict'
;
2
3
function
toParts
(
uri
) {
4
if
(!
uri
)
return
[];
5
6
var
parts
=
uri
.
split
(
'/'
);
7
8
var
i
;
9
for
(
i
=
parts
.
length
;
i
>=
1
&& !
parts
[
i
-
1
];
i
--);
10
parts
.
length
=
i
;
11
12
return
parts
;
13
}
14
15
function
toPath
(
uri
) {
16
return
toParts
(
uri
).
join
(
'/'
);
17
}
18
19
module
.
exports
= {
20
toParts
:
toParts
,
21
toPath
:
toPath
22
};