pkdls
TypeScript icon, indicating that this package has built-in type declarations

0.2.9 • Public • Published

pokemon

Get Pokémon names

Install

$ npm install pokemon

Usage

const pokemon = require('pokemon');

pokemon.all();
// ['Bulbasaur', …]

pokemon.random();
// 'Snorlax'

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

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

API

.all(language?)

Get all Pokémon names as a string[].

language

Type: string
Default: 'es'

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

pokemon.all();
// ['Bulbasaur', …]
pokemon.all('es');
// ['Pikachu', …]

.random(language?)

Get random Pokémon name.

language

Type: string
Default: 'es'

Language code to retrieve the Pokémon for.

pokemon.random();
// 'Vigoroth'
pokemon.random('es');
// 'Muntier'

.getName(id, language?)

Get Pokémon name from ID.

id

Type: number

The ID of a Pokémon, retrieved via getId().

language

Type: string
Default: 'es'

Language code to retrieve the Pokémon for.

pokemon.getName(100);
// 'Voltorb'
pokemon.getName(100, 'es');
// 'Voltobal'

.getId(name, language?)

Get Pokémon ID from name.

name

Type: string

The Pokémon name in the language locale.

language

Type: string
Default: 'es'

Language code of the localized name.

pokemon.getId('Snorlax');
// 143
pokemon.getId('Relaxo', 'es');
// 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)
  • es (Spanish)
  • ja (Japanese)
  • ko (Korean)
  • ru (Russian)
  • th (Thai)
  • zh-Hans (Simplified Chinese)
  • zh-Hant (Traditional Chinese)

The language codes follow the IETF BCP 47 standard.

Readme

Keywords

none

Package Sidebar

Install

npm i pkdls

Weekly Downloads

1

Version

0.2.9

License

MIT

Unpacked Size

153 kB

Total Files

15

Last publish

Collaborators

  • delirius