Skip to content

NPM Package to randomly draw a card from a full deck.

Notifications You must be signed in to change notification settings

Synic-dx/cardDraw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NPM Version NPM License NPM Downloads NPM Total Downloads

cardDraw

NPM Package to randomly draw a card from a full deck.

Installation

npm install card-draw

Usage

import cardDraw from 'card-draw'; // if you don't want the drawn card to be replaced in the deck
import cardDrawReplacement from 'card-draw' // if you want the card to be replaced in the deck

console.log(cardDraw()) // returns a randomly selected card as an object and removes it from the deck
console.log(cardDraw().suit) //returns the suit of the randomly drawn card and removes it from the deck

console.log(cardDrawReplacement()) // returns a randomly selected card as an object and keeps it back in the deck
console.log(cardDrawReplacement().suit) //returns the suit of the randomly drawn card and keeps it back in the deck

Notes

Adjust the 'value' property of the cards in accordance with the relevant game rules.

Releases

No releases published

Packages

No packages published