Get unlimited public & private packages + team-based management with npm Teams.Learn more »

pokemon

2.0.2 • Public • Published

pokemon Build Status

Get Pokémon names

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

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: 'en'

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

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

.random([language])

Get random Pokémon name.

language

Type: string
Default: 'en'

Language code to retrieve the Pokémon for.

pokemon.random();
//=> 'Vigoroth'
pokemon.random('de');
//=> '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: 'en'

Language code to retrieve the Pokémon for.

pokemon.getName(100);
//=> 'Voltorb'
pokemon.getName(100, 'de');
//=> '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: 'en'

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

Install

npm i pokemon

DownloadsWeekly Downloads

321

Version

2.0.2

License

MIT

Unpacked Size

106 kB

Total Files

13

Last publish

Collaborators

  • avatar