UNPKG

453 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.urlToList = urlToList;
7// /userInfo/2144/id => ['/userInfo','/userInfo/2144,'/userInfo/2144/id']
8function urlToList(url) {
9 if (!url || url === '/') {
10 return ['/'];
11 }
12 var urlList = url.split('/').filter(function (i) {
13 return i;
14 });
15 return urlList.map(function (urlItem, index) {
16 return "/".concat(urlList.slice(0, index + 1).join('/'));
17 });
18}
\No newline at end of file