-
-
Save flagrede/4471044563611d572707c96546d64635 to your computer and use it in GitHub Desktop.
Zelda BOTW Part 1: getItems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import items from "../data/items"; | |
import { | |
ItemType, | |
ItemsMainCategoriesType, | |
ItemCategoriesType, | |
} from "../data/items.type"; | |
const emptyItem = { | |
name: "", | |
icon: "", | |
value: "", | |
description: "", | |
category: ItemCategoriesType.WEAPON, | |
}; | |
const getItems = ( | |
category = ItemsMainCategoriesType.WEAPONS, | |
itemsPerPage = 20 | |
): ItemType[] => { | |
const itemsGrid = items[category].concat( | |
new Array(itemsPerPage - items[category].length).fill(emptyItem) | |
); | |
return itemsGrid; | |
}; | |
export default getItems; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment