1.0.2 • Published 4 years ago

card-deck-strings v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Playing cards' strings

It's convenient to use Unicode strings while prototyping a card game.

Wikipedia Demo

This library is a small wrapper for those strings to make it even more convenient.

Setup

card-deck-strings can be installed with npm or using a content delivery network URL to embed it on your HTML page

npm i card-deck-strings

or

<script src="https://unpkg.com/card-deck-strings"></script>

Usage

Card strings can be obtained by a name or id. The both are case insensitive. The trump strings are obtained by index. See the full list in Wiki.

import { getCard, getCardBack, getJoker, getTrump } from 'card-deck-strings';
const aceOfSpades = getCard('Ace of Spades');
const as = getCard('as');
const back = getCardBack();
const redJoker = getJoker('Red Joker');
const whiteJoker = getJoker('wj');
const fool = getTrump(0);

Given loaded in the global context, the methods above live under CardDeck namespce.

const queenOfDiamonds = CardDeck.getCard('QD');

License

Copyright © 2019, Sergey Chernykh. Released under the MIT License.