UNPKG

@state-less/leap-frontend

Version:

A collection of open source fullstack services powered by React Server

10 lines (9 loc) 282 B
export const getBreadCrumbs = (pathName, getTitle) => { const arr = ['', ...pathName.split('/').filter(Boolean)].map((e) => getTitle(e)); for (let i = 0; i < arr.length; i++) { if (i % 2 !== 0) { arr.splice(i, 0, '/'); } } return arr; };