1.0.1 • Published 6 years ago

pokemon-app-lib v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

PokeAPI Library

Build Status Coverage Status

A library to work with the PokeAPI v2.

Browser Support

ChromeFirefoxOperaSafariIE
39+ ✔42+ ✔29+ ✔10.1+ ✔IE11+ ✔

Dependencies

This library depends on fetch to make requests to the PokeAPI Web API. For environments that don't support fetch, you'll need to provide a polyfill to browser or polyfill to Node.

Installation

$ npm install pokemon-app-lib --save-dev

How to use

// to import a specific method
import { method } from 'pokemon-app-lib';

const [name] = method('[your search]');

// Example:

import { searchByName } from 'pokemon-app-lib';

const squirtleFetch = searchByName('squirtle');

UMD in Browser

<!-- to import non-minified version -->
<script src="pokemon-app-lib.umd.js"></script>

<!-- to import minified version -->
<script src="pokemon-app-lib.umd.min.js"></script>

After that the library will be available to the Global as pokemonAppLib. Follow an example:

let pokemon = pokemonAppLib.searchByName('charizard');

Methods

Follow the methods that the library provides. You can test all methods in PokeAPI.

searchByName(query)

This method will search your pokemon by the name.

Arguments

ArgumentTypeOptions
querystring or number'Any search query'

Example

pokemonAppLib.searchByName('charizard')
  .then(data => {
    // do what you want with the data
  })

searchByType(query)

This method will search all pokemons from chosen type.

Arguments

ArgumentTypeOptions
querystring or number'Any search query'

Example

pokemonAppLib.searchByType('flying')
  .then(data => {
    // do what you want with the data
  })

searchByAbility(query)

This method will one ability pokemons from one type.

Arguments

ArgumentTypeOptions
querystring or number'Any search query'

Example

pokemonAppLib.searchByAbility(13)
  .then(data => {
    // do what you want with the data
  })

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

Gabriel Santos
Gabriel Santos

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Thanks

Special thanks to Willian Justen for that wonderful TDD course!