Table Of Contents
About
pokemon.js is a Node.js module that makes interacting with PokéAPI easier.
Installation
Node.js 12.0.0 or newer is required.
No dependencies are required.
npm install pokemon.js
Example Usage
const Pokemon = require('pokemon.js');
Pokemon.setLanguage('english');
Pokemon.getPokemon('pikachu').then(console.log);
Methods
-
getPokemon(pokemon)
:
Returns data for the pokémon in JSON format. -
getType(pokemon | type)
:
Returns an Array that contains the pokémon's type(s) or returns data for the type in JSON format. -
getAbility(pokemon | ability)
:
Returns an Array that contains the pokémon's abilities or returns data for the ability in JSON format. -
getSprites(pokemon)
:
Returns an Object that contains the sprites for the pokémon. -
getStats(pokemon)
:
Returns an Object that contains the stats for the pokémon. -
getForms(pokemon)
:
Returns an Array that contains the forms for the pokémon. -
getEvolutionLine(pokemon)
:
Returns an Array that contains the evolution line of the pokémon. -
canLearn(pokemon)
:
Determines whether the pokémon can learn a move, retruning true or false. -
getMove(pokemon | move)
:
Returns an Array that contains the moves the pokémon learns or data on the move in JSON format. -
getNature(nature)
:
Returns an Object that contains the increased and decreased stat caused by the nature. -
getItem(item)
:
Returns data on the item in JSON format. -
getRegion(region)
:
Returns data on the region in JSON format. -
getGeneration(generation)
:
Returns data on the generation in JSON format. -
getAll(type)
:
Returns an Array that contains the names of all the specified type. -
setLanguage(language)
:
Sets the language to the language you prefer if available. -
getLanguage()
Returns the current language.