@jeremyckahn/farmhand
Version:
A farming game
15 lines (11 loc) • 298 B
text/typescript
import { itemsMap } from '../data/maps.js'
/**
* @throws If no item exists for the provided id.
*/
export const getItemById = (id: string): farmhand.item => {
const item = itemsMap[id as keyof typeof itemsMap]
if (!item) {
throw new Error(`Unknown item id: ${id}`)
}
return item
}