function getCategories()

in pbi-heat-streams/src/data/convertCategoricalDataView.ts [73:87]


function getCategories(
	categoryIds: CategoryId[],
	categoryNames: string[],
): [ICategory[], Record<CategoryId, ICategory>] {
	const categories = categoryNames.map((categoryName, index) => ({
		index,
		id: categoryIds[index],
		name: categoryName,
	}))
	const categoriesById = categories.reduce((prev, curr) => {
		prev[curr.id] = curr
		return prev
	}, <Record<CategoryId, ICategory>>{})
	return [categories, categoriesById]
}