/** Breadcrumb */
const breadcrumbItem = (name, icon, route = {name:'index'}) => ({ name, icon, route })

const breadcrumbMeta = (route) => {
    let breadcrumbs = [];

    route.matched.forEach(match => {
        if(match.name && match.meta?.title) {
            breadcrumbs.push(breadcrumbItem(match.meta.title, match.meta.icon, {name: match.name}));
        }
    });

    return breadcrumbs;
}

export {
    breadcrumbItem,
    breadcrumbMeta,
}