path with proper links
This commit is contained in:
27
src/utils/index.js
Normal file
27
src/utils/index.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function convertPathToHtml(path) {
|
||||
let count = 0
|
||||
while (path.startsWith('../')) {
|
||||
count++
|
||||
path = path.slice(3)
|
||||
}
|
||||
|
||||
if (count === 2) {
|
||||
return '.'
|
||||
}
|
||||
|
||||
if (count === 3) {
|
||||
return '..'
|
||||
}
|
||||
|
||||
if (count === 4) {
|
||||
return '../..'
|
||||
}
|
||||
|
||||
if (count === 5) {
|
||||
return '../../..'
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
export { convertPathToHtml }
|
||||
Reference in New Issue
Block a user