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

@bannon/cards

v0.2.0

Published

A small TypeScript toolkit for building games with standard playing cards, with no runtime dependencies

Readme

cards

A small, dependency-free toolkit for representing standard playing cards

Documentation

Setup

This project uses Node.js 22 and npm.

nvm use
npm install

To install the package in another project:

npm install @bannon/cards

Core API Usage

Create, shuffle, deal, and inspect a standard deck:

import { Deck, Hand } from '@bannon/cards';

const deck = new Deck().shuffle();
const players = [new Hand(), new Hand()];

deck.dealTo(players, 5);

for (const card of players[0].cards) {
    console.log(card.toString()); // e.g. 'A♠'
}

Browser bundles

The package publishes a standalone ESM bundle for browsers.

The core bundle exports the card model:

<script type="module">
    import { Deck } from 'https://unpkg.com/@bannon/cards@latest/dist/cards.js';

    const deck = new Deck().shuffle();
</script>

The same file is available from jsDelivr:

https://cdn.jsdelivr.net/npm/@bannon/cards@latest/dist/cards.js

Development

| Command | Purpose | | --- | --- | | npm test | Run the Jest test suite against TypeScript source. | | npm run typecheck | Type-check the library and TypeScript examples. | | npm run lint | Check JavaScript and TypeScript for code-quality and style issues. | | npm run lint:fix | Apply ESLint's safe automatic fixes. | | npm run format | Format JavaScript, TypeScript, and configuration files with Prettier. | | npm run format:check | Check formatting without changing files. | | npm run build | Build ESM browser and declaration outputs. | | npm run dev | Rebuild package outputs on source changes. | | npm run docs:dev | Run the documentation site locally. | | npm run docs:build | Build the package and the documentation site. | | npm run docs:preview | Preview the built documentation site. | | npm run coverage | Create the coverage report. | | npm run check | Type-check, test, lint, verify formatting, and build. |

Project layout

src/                    Card model, collections, identifiers, and hand evaluators
test/                   Jest test suite, mirroring the source files

The package publishes @bannon/cards as ESM (dist/cards.js) and TypeScript declarations (dist/index.d.ts).

The standalone browser ESM bundle is dist/cards.js.

The main @bannon/cards entry point exports Card, Pile, Deck, Hand, ranks, findRank, suits, findSuit, BlackjackHandEvaluator, and PokerHandEvaluator, plus their public TypeScript types.

Run npm pack --dry-run to inspect the exact publishable files.