github.com/DerekStrickland/consul@v1.4.5/ui-v2/app/utils/ascend.js (about) 1 export default function(path, num) { 2 const parts = path.split('/'); 3 return parts.length > num 4 ? parts 5 .slice(0, -num) 6 .concat('') 7 .join('/') 8 : ''; 9 }