Laravel.io
categoryBySlug: (state, getters) => slug => {
        if (getters.allCategories.length > 0) {
            return getters.allCategories.filter(p => p.slug === slug)[0];
        }
    },
    allProductsById: (state, getters) => id => {
        if (state.products.length > 0
        ) {
            return state.products;
        }
    },

Please note that all pasted data is publicly available.