pathTools.ts 301 Bytes
Newer Older
1
// /userinfo/2144/id => ['/userinfo','/useinfo/2144,'/userindo/2144/id']
2
// eslint-disable-next-line import/prefer-default-export
3 4
export function urlToList(url) {
  const urllist = url.split('/').filter(i => i);
5
  return urllist.map((urlItem, index) => `/${urllist.slice(0, index + 1).join('/')}`);
6
}