npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

promisemon

v1.0.4

Published

The ultimate pokedex you will ever need

Downloads

4

Readme

promisemon

npm version npm

Maintainers: Ashay

The best and easiest way to use Pokéapi v2 with promises in node.js

Table of Contents

Install nodeVersion

npm install promisemon --save
yarn add promisemon

Usage

var Pokedex = require('promisemon');
var P = new Pokedex();

NOTE: Refer to the pokeapi v2 docs to find out more about how the data is structured.

  P.getPokemon('eevee') // with Promise
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Configuration

Pass an Object to Pokedex in order to configure it. Available options: protocol, hostName, versionPath, cacheLimit in ms, timeout in ms. Any option is optional :smile:. If no Object is passed, the Pokedex will be initialized to grab data from pokeapi.co using http with 20 seconds timeout and caching resources for 11 days. HTTPS is the default protocol.

var Pokedex = require('promisemon');
var options = {
  protocol: 'https',
  hostName: 'localhost:443',
  versionPath: '/api/v2/',
  cacheLimit: 100 * 1000, // 100s
  timeout: 5 * 1000 // 5s
}
var P = new Pokedex(options);

Endpoints

Berries

Use getBerry to return data about a specific berry.

  P.getBerry('cheri')
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getBerryFirmness to return data about the firmness of a specific berry.

  P.getBerryFirmness('very-soft')
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getBerryFlavor to return data about the flavor of a specific berry.

  P.getBerryFlavor('spicy')
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Contests

Use getContestType to return data about the effects of moves when used in contests.

  P.getContestType('cool')
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getContestEffect to return data about the effects of moves when used in contests.

  P.getContestType(1)
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getSuperContestEffect to return data about the effects of moves when used in super contests.

  P.getSuperContestType(1)
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Encounters

Use getEncounterMethod to return data about the conditions in which a trainer may encounter a pokemon in the wild.

  P.getEncounterMethod("walk")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getEncounterCondition to return data that affects which pokemon might appear in the wild.

  P.getEncounterCondition("swarm")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getEncounterConditionValue to return data the various states that an encounter condition can have.

  P.getEncounterConditionValue("swarm-yes")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Evolution

Use getEvolutionChain to return data evolution chains.

  P.getEvolutionChain(1)
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getEvolutionTrigger to return data about triggers which cause pokemon to evolve.

  P.getEvolutionTrigger("level-up")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Games

Use getGeneration to return data about the different generations of pokemon games.

  P.getGeneration("generation-i")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getPokedex to return data about specific types of pokedexes.

  P.getPokedex("kanto")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getVersion to return data about specific versions of pokemon games.

  P.getVersion("red")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getVersionGroup to return data about specific version groups of pokemon games.

  P.getVersionGroup("red-blue")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Items

Use getItem to return data about specific items.

  P.getItem("master-ball")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getItemAttribute to return data about specific item attribute.

  P.getItemAttribute("countable")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getItemCategory to return data about specific item category.

  P.getItemCategory("stat-boosts")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getItemFlingEffect to return data about specific item fling effect.

  P.getItemFlingEffect("badly-poison")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getItemPocket to return data about specific pockets in a players bag.

  P.getItemPocket("misc")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Machines

Use getMachine to return data about specific machine.

  P.getMachine(2)
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Moves

Use getMove to return data about specific pokemon move.

  P.getMove("pound")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getMoveAilment to return data about specific pokemon move ailment.

  P.getMoveAilment("paralysis")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getMoveBattleStyle to return data about specific pokemon move battle style.

  P.getMoveBattleStyle("attack")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getMoveCategory to return data about specific pokemon move category.

  P.getMoveCategory("ailment")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getMoveDamageClass to return data about specific pokemon damage class.

  P.getMoveDamageClass("status")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getMoveLearnMethod to return data about specific pokemon learn method.

  P.getMoveLearnMethod("level-up")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getMoveTarget to return data about specific pokemon move target.

  P.getMoveTarget("specific-move")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Locations

Use getLocation to return data about specific pokemon location.

  P.getLocation("sinnoh")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getLocationArea to return data about specific pokemon location area.

  P.getLocationArea("canalave-city-area")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getPalParkArea to return data about specific pokemon pal park area.

  P.getPalParkArea("forest")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getRegion to return data about specific pokemon region.

  P.getRegion("kanto")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Pokemon

Use getAbility to return data about specific pokemon ability.

  P.getAbility("stench")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getCharacteristic to return data about specific pokemon characteristic.

  P.getCharacteristic(1)
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getEggGroup to return data about specific pokemon egg group.

  P.getEggGroup("monster")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getGender to return data about specific pokemon gender.

  P.getGender("female")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getGrowthRate to return data about specific pokemon growth rate.

  P.getGrowthRate("slow")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getNature to return data about specific pokemon nature.

  P.getNature("bold")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getPokeathlonStat to return data about specific pokeathon stat.

  P.getPokeathlonStat("speed")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getPokemon to return data about specific pokemon.

  P.getPokemon("butterfree")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getPokemonColor to return data about specific pokemon color.

  P.getPokemonColor("black")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getPokemonForm to return data about specific pokemon form.

  P.getPokemonForm("wormadam-plant")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getPokemonHabitat to return data about specific pokemon habitat.

  P.getPokemonHabitat("grottes")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getPokemonShape to return data about specific pokemon shape.

  P.getPokemonShape("ball")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getPokemonSpecies to return data about specific pokemon species.

  P.getPokemonSpecies("wormadam")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getStat to return data about specific pokemon stat.

  P.getStat("attack")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Use getType to return data about specific pokemon type.

  P.getType("ground")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Utility

Use getLanguage to return data about specific pokemon language.

  P.getLanguage("ja")
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log('There was an ERROR: ', error);
    });

Root Endpoints

For each root endpoint we provide a method to get all the items contained by that endpoint. By default the method will return every item in the endpoint. If you want you can configure its offset and limit.

  • offset is where to start. The first item that you will get. Default 0
  • limit is how many items you want to list. Default 100000

TIP: Do not pass any config Object to your call, since you will get every item and everything will be cached to your RAM.

This call will get the list of pokemon between ID 34 and ID 44

  var interval = {
    limit: 10,
    offset: 34
  }
  P.getPokemonsList(interval)
    .then(function(response) {
      console.log(response);
    })

This is what you will get:

{
  "count": 811,
  "next":  "https://pokeapi.co:443/api/v2/pokemon/?limit=11&offset=44",
  "previous": "https://pokeapi.co:443/api/v2/pokemon/?limit=11&offset=22",
  "results": [
    { 
      "url": "https://pokeapi.co:443/api/v2/pokemon/34/",
      "name": "nidoking" 
    },
    { 
      "url": "https://pokeapi.co:443/api/v2/pokemon/35/",
      "name": "clefairy"
    },
    {
      "url": "...",
      "name": "..."
    },
    { 
      "url": "https://pokeapi.co:443/api/v2/pokemon/44/",
      "name": "gloom"
    }
  ]
}

List of supported root endpoints

  • .getEndpointsList()
  • .getBerriesList()
  • .getBerriesFirmnesssList()
  • .getBerriesFlavorsList()
  • .getContestTypesList()
  • .getContestEffectsList()
  • .getSuperContestEffectsList()
  • .getEncounterMethodsList()
  • .getEncounterConditionsList()
  • .getEncounterConditionValuesList()
  • .getEvolutionChainsList()
  • .getEvolutionTriggersList()
  • .getGenerationsList()
  • .getPokedexsList()
  • .getVersionsList()
  • .getVersionGroupsList()
  • .getItemsList()
  • .getItemAttributesList()
  • .getItemCategoriesList()
  • .getItemFlingEffectsList()
  • .getItemPocketsList()
  • .getMachinesList()
  • .getMovesList()
  • .getMoveAilmentsList()
  • .getMoveBattleStylesList()
  • .getMoveCategoriesList()
  • .getMoveDamageClassesList()
  • .getMoveLearnMethodsList()
  • .getMoveTar()
  • .getsList()
  • .getLocationsList()
  • .getLocationAreasList()
  • .getPalParkAreasList()
  • .getRegionsList()
  • .getAbilitiesList()
  • .getCharacteristicsList()
  • .getEggGroupsList()
  • .getGendersList()
  • .getGrowthRatesList()
  • .getNaturesList()
  • .getPokeathlonStatsList()
  • .getPokemonsList()
  • .getPokemonColorsList()
  • .getPokemonFormsList()
  • .getPokemonHabitatsList()
  • .getPokemonShapesList()
  • .getPokemonSpeciesList()
  • .getStatsList()
  • .getTypesList()
  • .getLanguagesList()