Add getKindToCategory helper

This commit is contained in:
Sam Carlton 2022-06-03 16:17:07 -05:00
parent 29668409f8
commit 43dfe4eccf

View file

@ -213,7 +213,8 @@ export function getCategoryKindName ( categorySlug ) {
return categoryToKind[ categorySlug ]
}
return categories[ categorySlug ].slug
export function getKindToCategory ( kindSlug ) {
return Object.keys( categories ).find( key => categoryToKind[ key ] === kind )
}
export const categoriesById = Object.fromEntries( Object.entries( categories ).map( ([ key, category ]) => [category.id, { ...category, key } ] ) )