pokemon-es5

1.2.2 • Public • Published

pokemon Build Status

Get Pokémon names

This is a fork of sindresorhus' pokemon package with ES5 compability. If you don't need ES5 compability please consider using his package.

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

Install

$ npm install --save pokemon

Usage

const pokemon = require('pokemon');
 
pokemon.all();
//=> ['Bulbasaur', ...]
 
pokemon.random();
//=> 'Snorlax'
 
pokemon.getName(147);
//=> 'Dratini'
 
pokemon.getId('Dratini');
//=> 147

API

.all(lang: string = 'en'): string[]

Get a list of all names.

lang

Language code to retrieve the list of Pokémon for.

pokemon.all();
//=> ['Bulbasaur', ...]
pokemon.all('de');
//=> ['Bisasam', ...]

.random(lang: string = 'en'): string

Random name.

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

Get name from ID.

lang

Language code to retrieve the Pokémon for.

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

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

Get ID from name.

lang

Language code of the localized name.

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

.languages: Set

pokemon.languages.has('ja');
//=> true

Supported languages

Pokémon names are available for the following languages:

  • de (German)
  • en (English)
  • fr (French)
  • ja (Japanese)
  • ko (Korean)
  • ru (Russian)
  • zh-Hans (Simplified Chinese)
  • zh-Hant (Traditional Chinese)

The language codes follow the IETF BCP 47 standard.

Related

License

MIT © Sindre Sorhus

Package Sidebar

Install

npm i pokemon-es5

Weekly Downloads

2

Version

1.2.2

License

MIT

Last publish

Collaborators

  • dominik-th