UNPKG

ts-cards

Version:
52 lines (51 loc) 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Trick = void 0; var Trick = /** @class */ (function () { function Trick(card, cardCompare, trump) { this._cards = []; this.sortedCards = []; this.leadSuit = card.suit; this.trumpSuit = trump; this.compareCards = cardCompare; this.addCard(card); } Trick.prototype.addCard = function (card) { var _this = this; this.cards.push(card); this.sortedCards.push(card); this.sortedCards.sort(function (a, b) { return _this.compareCards(a, b, _this.leadSuit, _this.trumpSuit); }); }; Object.defineProperty(Trick.prototype, "cards", { get: function () { return this._cards; }, enumerable: false, configurable: true }); Object.defineProperty(Trick.prototype, "winningCard", { get: function () { return this.sortedCards[0]; }, enumerable: false, configurable: true }); Object.defineProperty(Trick.prototype, "length", { get: function () { return this.cards.length; }, enumerable: false, configurable: true }); Object.defineProperty(Trick.prototype, "suit", { get: function () { return this.leadSuit; }, enumerable: false, configurable: true }); return Trick; }()); exports.Trick = Trick;