mudkipme / pokeapi-v2-typescript

TypeScript definitions for pokedex-promise-v2 and PokeAPI endpoints.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type definitions for PokeAPI and pokedex-promise-v2

Installation

npm install --save mudkipme/pokeapi-v2-typescript#<commit hash>

Usage

import Pokedex from "pokedex-promise-v2";

(async () => {
    const pokedex = new Pokedex();
    const species = await pokedex.getPokemonSpeciesByName("mudkip");
    const variety = species.varieties.find((speciesVariety) => speciesVariety.is_default);
    if (variety) {
        const pokemon = await pokedex.resource(variety.pokemon.url);
        const types = await Promise.all(pokemon.types.map((pokemonType) => pokedex.resource(pokemonType.type.url)));
        console.log(types.map((type) => type.names));
    }
})();

Generation (no pun intended)

npm run build

License

MIT

About

TypeScript definitions for pokedex-promise-v2 and PokeAPI endpoints.

License:MIT License


Languages

Language:JavaScript 100.0%