Skip to content

Instantly share code, notes, and snippets.

@flagrede
Last active June 27, 2020 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flagrede/4471044563611d572707c96546d64635 to your computer and use it in GitHub Desktop.
Save flagrede/4471044563611d572707c96546d64635 to your computer and use it in GitHub Desktop.
Zelda BOTW Part 1: getItems
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