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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pokedex-ts

v1.0.0

Published

A fast, simple, and fully-typed TypeScript wrapper for the PokeAPI. Built-in caching, zero runtime dependencies.

Readme

pokedex-ts

A fast, simple, and fully-typed TypeScript wrapper for the PokeAPI. Built-in LRU caching, zero runtime dependencies, and a clean API that abstracts away all the complexity.

✨ Features

  • ⚡ Fast — In-memory LRU cache so repeated lookups are instant
  • 🎯 Simple — One class, intuitive method names, clean return types
  • 🔒 Fully Typed — Written in TypeScript with complete type definitions
  • 📦 Zero Dependencies — Uses native fetch (Node 18+)
  • 🔍 Search — Fuzzy search Pokémon by partial name

📦 Installation

npm install pokedex-ts
yarn add pokedex-ts

🚀 Quick Start

import { Pokedex } from "pokedex-ts";

const dex = new Pokedex();

// Get a Pokémon by name or ID
const pikachu = await dex.getPokemon("pikachu");
console.log(pikachu.name);       // "pikachu"
console.log(pikachu.types);      // [{ slot: 1, name: "electric" }]
console.log(pikachu.stats);      // [{ baseStat: 35, effort: 0, name: "hp" }, ...]

// Get all fire-type Pokémon
const fireTypes = await dex.getPokemonByType("fire");
console.log(fireTypes.length);   // 90+

// Search by partial name
const results = await dex.searchPokemon("char");
// → [{ name: "charmander" }, { name: "charmeleon" }, { name: "charizard" }, ...]

📖 API Reference

new Pokedex(options?)

| Option | Type | Default | Description | |---|---|---|---| | cacheMaxSize | number | 500 | Max entries in the LRU cache | | cacheTTL | number | 300000 | Cache entry lifetime in ms (5 min) |


Methods

| Method | Returns | Description | |---|---|---| | getPokemon(nameOrId) | Promise<Pokemon> | Get a single Pokémon by name or Dex number | | getPokemonSpecies(nameOrId) | Promise<PokemonSpecies> | Get species info (flavor text, generation, legendary status) | | getAllPokemon(limit?, offset?) | Promise<PaginatedResult<NamedResource>> | Paginated list of all Pokémon | | getPokemonByType(type) | Promise<NamedResource[]> | All Pokémon of a given type | | getGeneration(nameOrId) | Promise<Generation> | Get a generation and its Pokémon list | | getAllGenerations() | Promise<NamedResource[]> | List every generation | | getType(nameOrId) | Promise<TypeDetail> | Get type details and damage relations | | getAllTypes() | Promise<NamedResource[]> | List every type | | searchPokemon(query) | Promise<NamedResource[]> | Fuzzy search Pokémon by partial name | | clearCache() | void | Flush the in-memory cache |


Key Types

interface Pokemon {
  id: number;
  name: string;
  height: number;
  weight: number;
  baseExperience: number;
  types: PokemonType[];
  stats: PokemonStat[];
  abilities: PokemonAbility[];
  sprites: PokemonSprites;
  moves: PokemonMove[];
}

interface PokemonSpecies {
  id: number;
  name: string;
  generation: string;
  flavorTextEntries: FlavorTextEntry[];
  evolutionChainUrl: string | null;
  isLegendary: boolean;
  isMythical: boolean;
  habitat: string | null;
  color: string;
}

interface Generation {
  id: number;
  name: string;
  region: string;
  pokemonSpecies: NamedResource[];
  types: NamedResource[];
  moves: NamedResource[];
}

interface TypeDetail {
  id: number;
  name: string;
  damageRelations: DamageRelations;
  pokemon: NamedResource[];
}

🧪 Examples

Get Generation I Pokémon

const gen1 = await dex.getGeneration(1);
console.log(`${gen1.name} (${gen1.region}): ${gen1.pokemonSpecies.length} Pokémon`);
// → "generation-i (kanto): 151 Pokémon"

Type Matchups

const fire = await dex.getType("fire");
console.log("Fire is weak to:", fire.damageRelations.doubleDamageFrom.map(t => t.name));
// → ["ground", "rock", "water"]

Species Info

const species = await dex.getPokemonSpecies("mewtwo");
console.log(species.isLegendary);  // true
console.log(species.generation);   // "generation-i"

Custom Cache Settings

const dex = new Pokedex({
  cacheMaxSize: 1000,     // Store up to 1000 entries
  cacheTTL: 600_000,      // 10-minute TTL
});

📋 Requirements

  • Node.js ≥ 18 (uses native fetch)

📄 License

MIT