1.3.3 • Published 7 years ago

real-deal-deck-of-cards v1.3.3

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

real-deal-deck-of-cards

A deck of cards.

Shuffle up and deal. This package is an object oriented approach to creating a deck of cards (no jokers) that can be used in any card game.

Includes unit tests via mocha.

Usage

var realDealDeckOfCards = require('real-deal-deck-of-cards')

let deck = realDealDeckOfCards.createDeck();
let next = deck.nextCard();
console.log('Suit: ', next.suit, ', Name: ', next.name, ', Value: ', next.value);

deck.shuffle();
next = deck.nextCard();
let count = 1;
console.log('Suit: ', next.suit, ', Name: ', next.name, ', Value: ', next.value);

while (next = deck.nextCard()) {
    count++;
}
console.log('Done - '+count+' cards!');

outputs

Suit:  SPADES , Name:  Ace , Value:  1
Suit:  DIAMONDS , Name:  Two , Value:  2
Done - 52 cards!

Install

With npm installed, run

$ npm install real-deal-deck-of-cards

License

ISC

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago