Skip to content

serglider/card-deck-strings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Convenience wrapper for Unicode card string

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published