🎨 Pick your Pokémon to fight!
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images
pokedex
test/unit
.gitignore
.travis.yml
README.md
cli.js
index.js
package.json

README.md

pokemon-picker (npm)

npm version Travis Coverage Status

🎨 Pick your Pokémon from Pokédex!

I always have a problem for new project name.
I had simple an idea. I will create pokemon random getter.
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!

              ______                                           _____      ______              
_________________  /_____________ ________________     ___________(_)________  /______________
___  __ \  __ \_  //_/  _ \_  __ `__ \  __ \_  __ \    ___  __ \_  /_  ___/_  //_/  _ \_  ___/
__  /_/ / /_/ /  ,<  /  __/  / / / / / /_/ /  / / /    __  /_/ /  / / /__ _  ,<  /  __/  /    
_  .___/\____//_/|_| \___//_/ /_/ /_/\____//_/ /_/     _  .___//_/  \___/ /_/|_| \___//_/     
/_/                                                    /_/                                    


Install

$ npm install pokemon-picker

Usage (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
    

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"] }

Unit tests

Use Jasmine to create that type of tests.

$ npm test

Code coverage

Use Istanbul to get code coverage ratio.

$ npm run coverage

License

The MIT License @ 2014