pokemon-picker
v1.2.9
Published
🎨 Pick your Pokémon from Pokédex!
Downloads
186
Maintainers
Readme
pokemon-picker
🎨 Pick your Pokémon from Pokédex!
I always have a problem for new project name. I had a simple idea to create random pokemon generator. So I make this project to randomly select Pokémon.
I use bulbapedia.bulbagarden.net to get index, name and types.
ALL 756 Pokemons are available!
______ _____ ______
_________________ /_____________ ________________ ___________(_)________ /______________
___ __ \ __ \_ //_/ _ \_ __ `__ \ __ \_ __ \ ___ __ \_ /_ ___/_ //_/ _ \_ ___/
__ /_/ / /_/ / ,< / __/ / / / / / /_/ / / / / __ /_/ / / / /__ _ ,< / __/ /
_ .___/\____//_/|_| \___//_/ /_/ /_/\____//_/ /_/ _ .___//_/ \___/ /_/|_| \___//_/
/_/ /_/
CLI
After global installation:
npm install -g pokemon-picker
... you can CHOOSE random Pokémon by simple command:
pokemon-picker
... or print help with details:
pokemon-picker --help
Usage: pokemon-picker [options]
Pick your Pokémon from Pokédex!
Options:
-h, --help output usage information
-V, --version output the version number
-a Get whole list of Pokémons
-i [index] Get Pokémon by index
-n [name] Get Pokémon by name
-t [type] Get Pokémons by type
-r Return random Pokémon
-s Return number of database size
Install
npm install pokemon-picker
Usage (in code)
var pokemon = require('pokemon-picker');
pokemon.all(): Array<Pokémon>
Returns list of Pokémons.
pokemon.at(index: number): Pokémon
pokemon.byIndex(index: number): Pokémon
Return Pokémon object or undefined
value.
Parameters:
index
- number of create from the list.
pokemon.byName(name: string): Pokémon
Returns Pokémon object or undefined
value.
Parameters:
name
- Pokémon name.
pokemon.byType(type: string): Array<Pokémon>
Returns list of Pokémons with type.
Parameters:
type
- Pokémon type.
pokemon.randomize(): Pokémon
Return random "Pokémon" from whole list.
pokemon.size(): number
Return number of Pokémon's, which are available in database.
Examples
var pokemon = require('pokemon-picker');
pokemon.all() // ... returns whole list of Pokémons
pokemon.byIndex(0); // => { "index": 1, "name": "Bulbasaur", "types": ["Grass", "Poison"] }
pokemon.at(76); // => { "index": 76, "name": "Golem", "types": ["Rock", "Ground"] }
pokemon.byIndex(151); // => { "index": 151, "name": "Mew", "types": ["Psychic"] }
pokemon.byName("Pikachu"); // => { name: 'Pikachu', types: [ 'Electric' ], index: 25 }
pokemon.byType("Fire"); // => ... list of Fire Pokémons
pokemon.size() // 756 (all known creatures)
pokemon.randomize() // => { "index": 135, "name": "Electabuzz", "types": ["Electric"] }
pokemon.randomize() // => { "index": 65, "name": "Alakazam", "types": ["Psychic"] }
pokemon.randomize() // => { "index": 38, "name": "Ninetales", "types": ["Fire"] }
License
The MIT License @ 2014