fh-cards
v1.1.2
Published
A standard 52-card deck library
Downloads
18
Maintainers
Readme
FH Cards
A standard 52-card deck library.
Install
npm install fh-cards
Features
- Uses the Fisher-Yates shuffle algorithm
- Optional Joker cards
Example
This example is in TypeScript. It creates a standard deck, shuffles it, draws 2 cards, and then shows those two cards as strings.
import { Card, Deck, StandardDeck } from "fh-cards";
let deck: Deck = new StandardDeck();
deck.shuffle();
let hand: Card[] = deck.draws(2);
hand[0].toString(); // "8d"
hand[1].toString(); // "Ac"
This example is in JavaScript. It does the same thing as the previous example.
let fhc = require("fh-cards");
let StandardDeck = fhc.StandardDeck;
let deck = new StandardDeck();
deck.shuffle();
let hand = deck.draws(2);
hand[0].toString(); // "Ts"
hand[1].toString(); // "5h"