| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
NPM Package to randomly draw a card from a full deck.
npm install card-drawimport 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 deckAdjust the 'value' property of the cards in accordance with the relevant game rules.
| Back | FazBrowse Home | New Git URL |