13 lines
209 B
JavaScript
13 lines
209 B
JavaScript
|
export default path => {
|
||
|
if (path === undefined) {
|
||
|
return path
|
||
|
}
|
||
|
if (path === `/`) {
|
||
|
return `/`
|
||
|
}
|
||
|
if (path.charAt(path.length - 1) === `/`) {
|
||
|
return path.slice(0, -1)
|
||
|
}
|
||
|
return path
|
||
|
}
|