A TypeScript library for playing cards.
- See the documentation.
- Examples on RunKit.
- Includes examples on extending classes and using common components!
- See code on GitHub.
- Try it out in your project!
typedeck
gives you types and classes to help jumpstart your card-based game.
- Card
- Simple card classes (
PlayingCard
/JokerCard
)
- Simple card classes (
- Chip
- Provided Chip classes and standard values
- Values can be overridden, and custom Chip classes
- Provided Chip classes and standard values
- Declarative Types
CardName
:[Ace, Two, Three, ...]
Suit
:[Clubs, Spades, Diamonds, Hearts]
- Card collections
- Classes that represent multiple cards as a logical item.
Hand
- cards that belong to a playerCardPile
- cards that are frequently drawn from or added toDeck
- extension ofCardPile
with additional game-time helpers
- Classes that represent multiple cards as a logical item.
- Services
- Shuffle
- Shuffle any
ICard
implementation
- Shuffle any
- Poker Hand Scoring
- Texas Hold Em Hand Detection
- Winner scoring/determination
- Chip management
- Taking specific values
- Creating chips from value
- Breaking chips to get specific value
- Shuffle
- And so much more ... see the documentation for a full list.
Most features support parameters that implement either an interface or
a base class. You can create your own type of Card that implements ICard
or
a Chip with special chip color values which extends Chip
base class.
- Card images by Ben Davis from the Noun Project
- This library package is built from work by Jason Dreyzehner's typescript-starter project. This was the building block for docs, code coverage, and testing (among others).
- Poker hand scoring from @kequc