JSPM

  • Created
  • Published
  • Downloads 11660
  • Score
    100M100P100Q128242F
  • License MIT

Get Pokémon names

Package Exports

  • pokemon

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pokemon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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: string[]

All names.

.random(): string

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

.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)
  • zh (Chinese)

License

MIT © Sindre Sorhus