mirror of
https://github.com/BlossomiShymae/clean-cuts.git
synced 2025-12-06 10:10:47 +01:00
Add rarities composable and remove unused code
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
|
||||
const isNumeric = (num: any) => (typeof(num) === 'number' || typeof(num) === "string" && num.trim() !== '') && !isNaN(num as number);
|
||||
|
||||
export default function useQueryablePagination<T>(iterable: Array<T>, pageSize: number, query: Ref<string>) {
|
||||
const pagination = computed(() => {
|
||||
let filtered = [];
|
||||
if (isNumeric(query.value))
|
||||
filtered = iterable.filter((x: any) => x.id == parseInt(query.value, 10));
|
||||
else
|
||||
filtered = iterable.filter((x) => x.title.toLowerCase().includes(query.value.toLowerCase()));
|
||||
|
||||
return usePagination(icons, 100);
|
||||
})
|
||||
|
||||
return {
|
||||
|
||||
}
|
||||
}
|
||||
11
composables/useRarities.ts
Normal file
11
composables/useRarities.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export default function useRarities(value: any) {
|
||||
const rarities: any = {
|
||||
"1": "Rare",
|
||||
"2": "Epic",
|
||||
"3": "Legendary",
|
||||
"4": "Mythic",
|
||||
"5": "Ultimate"
|
||||
};
|
||||
if (Object.hasOwn(rarities, value)) return rarities[value];
|
||||
return "";
|
||||
}
|
||||
Reference in New Issue
Block a user