getEnums
getEnums
returns enum
s for the dataset. This is useful for parsing representatoinal fields into their official strings.
⚠️ NOTE ⚠️ If you just need to parse the
slot
andtype
of skills returned fromgetSkills
, you should probably usegetSkills
with theparseEnums
option.
Examples
import {
getEnums,
getSkills,
} from '@pokebag/data-sdk'
async function getParsedSkills() {
const skills = await getSkills()
const [
skillSlots,
skillTypes,
] = await Promise.all([
getEnums({ type: 'pokemon-skill-slot' }),
getEnums({ type: 'pokemon-skill-type' }),
])
return skills.map(skill => {
return {
...skill,
slot: skillSlots[skill.slot],
type: skillTypes[skill.type],
}
})
}
getParsedSkills()
// Logs an array of skills with enums parsed
Last updated
Was this helpful?