Create ElementTransformer

Transforms elements from numbers into objects and back again
This commit is contained in:
Justin Edmund 2023-07-06 00:01:17 -07:00
parent 9adcd50519
commit cb4fd491ac
2 changed files with 9 additions and 8 deletions

View file

@ -0,0 +1,9 @@
import { elements } from '../utils/elements'
export function toObject(value: number) {
return elements.find((element) => element.id === value) || elements[0]
}
export function toParam(value: string) {
return elements.find((element) => element.name.en === value)
}

View file

@ -63,11 +63,3 @@ export const elements: GranblueElement[] = [
slug: 'light',
},
]
export function numberToElement(value: number) {
return elements.find((element) => element.id === value) || elements[0]
}
export function stringToElement(value: string) {
return elements.find((element) => element.name.en === value)
}