/pokemon

Get Pokémon names

Primary LanguageJavaScriptMIT LicenseMIT

pokemon Build Status

Get Pokémon names

The name list is just a JSON file and can be used wherever.

Install

$ npm install --save pokemon

Usage

const pokemon = require('pokemon');

pokemon.random();
//=> 'Snorlax'

pokemon.getName(147);
//=> 'Dratini'

pokemon.getId('Dratini');
//=> 147

API

.all

Type: Array

All names.

.random()

Random name.

.getName(id: number, lang: string = 'en'): string

Get name from ID.

With the optional lang parameter you can get a localized name using a language code:

pokemon.getName(100);
//=> 'Voltorb'
pokemon.getName(100, 'de');
//=> 'Voltobal'

.getId(name: string, lang: string = 'en'): number

Get ID from name.

With the optional lang parameter you can get the ID for a localized name using a language code:

pokemon.getId('Snorlax');
//=> 143
pokemon.getId('Relaxo', 'de');
//=> 143

Supported languages

Pokémon names are available for the following languages:

  • de (German)
  • en (English)
  • fr (French)

Related

License

MIT © Sindre Sorhus