fh-cards

A standard 52-card deck library.

Usage no npm install needed!

<script type="module">
  import fhCards from 'https://cdn.skypack.dev/fh-cards';
</script>

README

FH Cards

A standard 52-card deck library.

npm npm npm Travis

Install

npm install fh-cards

Features

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"

Documentation

API

License

MIT