You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
512 B
21 lines
512 B
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.urlToList = urlToList;
|
|
|
|
// /userInfo/2144/id => ['/userInfo','/userInfo/2144,'/userInfo/2144/id']
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
function urlToList(url) {
|
|
if (!url || url === '/') {
|
|
return ['/'];
|
|
}
|
|
|
|
var urlList = url.split('/').filter(function (i) {
|
|
return i;
|
|
});
|
|
return urlList.map(function (urlItem, index) {
|
|
return "/".concat(urlList.slice(0, index + 1).join('/'));
|
|
});
|
|
} |