52-deck

Make 52 cards deck

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
10Apr 1, 2017Mar 31, 2017Minified + gzip package size for 52-deck in KB

Readme

52-deck

build: Dependency Status devDependency Status

Installation (2.46 kB)

  • yarn add 52-deck
  • or npm install 52-deck

Usage

Get 52 cards deck

import { newDeck } from '52-deck'

const deck = newDeck()

Shuffle 2 decks

import { shuffle, newDecks } from '52-deck'

const deck = shuffle(newDecks(2))

Serialize

import { serializeCards } from '52-deck'

const [ firstCard, secondCard ] = serializeCards('♦K ♦2')

Valid input strings are:

  • h1 s1 d12
  • 11d 9s 9d 4s 12h 13d 13h 11h
  • ♠10 ♦1 ♥5 ♣6 ♠11 ♦10
  • 1-h 10-s
  • 12spades 8diamond

Card Model

type Card = {
  text: string,
  suite: string,
  value: number,
  color: string
}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.