This commit is contained in:
Dragon Fire
2021-01-22 18:17:48 -05:00
parent 793ca59e18
commit 2364770b8f
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -8,7 +8,8 @@ module.exports = class AbilityStore extends Collection {
}
async fetch(query) {
query = this.makeSlug(query);
if (this.has(query)) return this.get(query);
query = this.makeSlug(query.toString());
if (!query) return null;
const found = this.find(pokemon => pokemon.slug === query);
if (found) return found;
+2 -1
View File
@@ -8,7 +8,8 @@ module.exports = class MoveStore extends Collection {
}
async fetch(query) {
query = this.makeSlug(query);
if (this.has(query)) return this.get(query);
query = this.makeSlug(query.toString());
if (!query) return null;
const found = this.find(pokemon => pokemon.slug === query);
if (found) return found;
+2 -1
View File
@@ -17,7 +17,8 @@ module.exports = class PokemonStore extends Collection {
}
async fetch(query) {
query = this.makeSlug(query);
if (this.has(query)) return this.get(query);
query = this.makeSlug(query.toString());
if (!query) return null;
const num = Number.parseInt(query, 10);
if (this.has(num)) return this.get(num);