File size: 954 Bytes
0dc7194 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /**
* Utilidades de filtrado para el dashboard.
*
* Expone funciones para extraer opciones unicas de filtros desde mercados.
*/
// ββ Extractores de opciones de filtro βββββββββββββββββββββββββββββββββββββββββ
export function extractFilterOptions(markets) {
const categories = new Set()
for (const m of markets) {
if (m.category) categories.add(m.category)
}
return {
categories: ['Todas', ...Array.from(categories).sort()],
}
}
// ββ Filtrado ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
export function filterMarkets(markets, { category }) {
return markets.filter((m) => {
if (category && category !== 'Todas' && m.category !== category) return false
return true
})
}
|