I have an object like this:
const CATEGORY_SLUGS = {
CATEGORY_1: { ES: "slug1-in-spanish", UK: "slug1-in-english" },
CATEGORY_2: { ES: "slug2-in-spanish", UK: "slug2-in-english" },
CATEGORY_3: { ES: "slug3-in-spanish", UK: "slug3-in-english" },
}
And in other part of my code I have the slug value, and the country is also known.
From those two information, what is the best way to know the CATEGORY? I mean, how to find out which category that slug refers to?
I can do it using a let variable and a for loop of some kind to check one by one and see what matches. But it's not looking good and I feel that there is a much cleaner solution out there.