diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 00000000..0d761afc
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,15 @@
+{
+ // See https://go.microsoft.com/fwlink/?LinkId=733558
+ // for the documentation about the tasks.json format
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "type": "typescript",
+ "tsconfig": "tsconfig.json",
+ "option": "watch",
+ "problemMatcher": [
+ "$tsc-watch"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/css/style.css b/css/style.css
index cc704eef..c194bb29 100644
--- a/css/style.css
+++ b/css/style.css
@@ -120,7 +120,7 @@ h1 {font-weight: bold; margin-left: 10px;}
padding:10px;
min-height:300px;
background:#eee;
- margin-bottom:10px;
+ margin-bottom:10px;
}
#menu {
float: left;
@@ -128,6 +128,10 @@ h1 {font-weight: bold; margin-left: 10px;}
margin: 0 0 0 10px;
}
+.btn {
+ margin: 15px 0 0 0;
+}
+
#menu ul {
list-style-type: none;
}
@@ -138,4 +142,4 @@ h1 {font-weight: bold; margin-left: 10px;}
#menu button {
width: 120px;
-}
+}
\ No newline at end of file
diff --git a/index.html b/index.html
index d2c3c254..e00ed092 100644
--- a/index.html
+++ b/index.html
@@ -4,28 +4,44 @@
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/js/BlackJack.js b/js/BlackJack.js
new file mode 100644
index 00000000..0ffcdca3
--- /dev/null
+++ b/js/BlackJack.js
@@ -0,0 +1,162 @@
+class BlackJack extends CardGame {
+ constructor(profile) {
+ super();
+ this.turnOrder = 0;
+ el.style.fontFamily = "Georgia";
+ body.style.webkitFilter = "sepia(0.6)";
+ title.style.fontFamily = "Chicle";
+ title.innerText = "Blackjack";
+ this.player = new BlackJackPlayer(profile);
+ addToDisplayText('Hello ' + this.player.profile.getName + '! Welcome to the BlackJack Table.');
+ }
+ updateInput() {
+ console.log(this.turnOrder);
+ if (this.turnOrder == 0) {
+ this.newHand();
+ this.turnOrder += 1;
+ console.log('turn 0 new hand');
+ }
+ else if (this.turnOrder == 1) {
+ this.betStep();
+ addToDisplayText('you bet ' + this.bet + ' chips.');
+ addToDisplayText('Would you like to hit?');
+ this.turnOrder += 1;
+ console.log('turn 1');
+ }
+ else if (this.turnOrder == 2) {
+ clearInput();
+ if (userInput == 'yes' && this.player.bust == false) {
+ this.playerDraw();
+ console.log('hitting');
+ this.calcHandValue(this.player.hand);
+ if (this.bustCheck(this.player.hand) == true) {
+ addToDisplayText('You bust!');
+ this.player.bust = true;
+ }
+ addToDisplayText('would you like to hit again?');
+ return;
+ }
+ if (userInput == 'yes' && this.player.bust == true) {
+ addToDisplayText('Naw, you already went bust.');
+ }
+ inputField.value = '';
+ console.log('dealer turn');
+ addToDisplayText('Dealer Taking Turn');
+ this.dealer.dealerTurn();
+ this.turnOrder += 1;
+ console.log('win check');
+ addToDisplayText('Final result is...');
+ this.dealer.bustCheck();
+ this.player.bustCheck();
+ this.winCheck();
+ addToDisplayText('would you like to play another hand?');
+ }
+ else if (this.turnOrder == 3) {
+ if (userInput == 'yes') {
+ console.log('restarting');
+ this.turnOrder = 0;
+ this.updateInput();
+ }
+ else {
+ addToDisplayText('ok goodbye forever');
+ mainMenu.getGameChoice();
+ }
+ inputField.value = '';
+ }
+ }
+ playerDraw() {
+ let tempCard = this.deck.cards.pop();
+ this.player.hand.push(tempCard);
+ addToDisplayText(this.player.profile.getName + " drew " + tempCard.value + " of " + tempCard.suit);
+ console.log('player drew ' + tempCard.value + " of " + tempCard.suit);
+ }
+ playerDrawFirstHand() {
+ this.playerDraw();
+ this.playerDraw();
+ console.log('player initial hand');
+ }
+ dealerDraw(show) {
+ let tempCard = this.deck.cards.pop();
+ this.dealer.hand.push(tempCard);
+ if (show == true) {
+ addToDisplayText("Dealer drew " + tempCard.value + " of " + tempCard.suit);
+ }
+ else {
+ addToDisplayText("Dealer drew one hidden card");
+ }
+ console.log('dealer drew ' + tempCard.value + " of " + tempCard.suit);
+ }
+ dealerDrawFirstHand() {
+ this.dealerDraw(true);
+ this.dealerDraw(false);
+ console.log('dealer initial hand');
+ }
+ betStep() {
+ this.bet = parseInt(inputField.value);
+ console.log('bet is now ' + this.bet);
+ inputField.value = '';
+ }
+ hitStep() {
+ this.playerDraw();
+ }
+ calcHandValue(hand) {
+ let handValue = 0;
+ hand.forEach(card => {
+ handValue += CardGame.cardValueInterpret(card.value);
+ });
+ addToDisplayText('Current hand value is ' + handValue);
+ return handValue;
+ }
+ bustCheck(hand) {
+ let handValue = 0;
+ hand.forEach(card => {
+ handValue += CardGame.cardValueInterpret(card.value);
+ });
+ if (handValue > 21) {
+ console.log('bust');
+ return true;
+ }
+ }
+ winCheck() {
+ if (this.calcHandValue(this.player.hand) > this.calcHandValue(this.dealer.hand)) {
+ this.winBet();
+ }
+ else if (this.player.bust == true) {
+ this.loseBet();
+ }
+ else if (this.player.bust == false && this.dealer.bust == true) {
+ this.winBet();
+ }
+ else if (this.calcHandValue(this.player.hand) === this.calcHandValue(this.dealer.hand)) {
+ this.drawBet();
+ }
+ else {
+ this.loseBet();
+ }
+ }
+ winBet() {
+ this.player.profile.addChips(this.bet);
+ console.log('player win, current chip count at ' + this.player.profile.getChips);
+ addToDisplayText('You win! Your new balance is ' + this.player.profile.getChips);
+ }
+ loseBet() {
+ this.player.profile.subtractChips(this.bet);
+ console.log('player lose, current chip count at ' + this.player.profile.getChips);
+ addToDisplayText('You lose! Your new balance is ' + this.player.profile.getChips);
+ }
+ drawBet() {
+ this.bet = 0;
+ addToDisplayText('Its a draw!');
+ }
+ newHand() {
+ this.deck = new Deck();
+ this.dealer = new dealer(this);
+ this.bet = 0;
+ this.player.hand = [];
+ this.playerDrawFirstHand();
+ this.dealerDrawFirstHand();
+ this.calcHandValue(this.player.hand);
+ addToDisplayText('Please place your bet!');
+ }
+}
+//# sourceMappingURL=BlackJack.js.map
\ No newline at end of file
diff --git a/js/BlackJack.js.map b/js/BlackJack.js.map
new file mode 100644
index 00000000..b73af22d
--- /dev/null
+++ b/js/Bl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@ -0,0 +1,27 @@
+class BlackJackPlayer {
+ constructor(profile) {
+ this.hand = [];
+ this.bust = false;
+ this.profile = profile;
+ }
+ calcHandValue() {
+ let handValue = 0;
+ this.hand.forEach(card => {
+ handValue += CardGame.cardValueInterpret(card.value);
+ });
+ addToDisplayText('Current hand value is ' + handValue);
+ return handValue;
+ }
+ bustCheck() {
+ let handValue = 0;
+ this.hand.forEach(card => {
+ handValue += CardGame.cardValueInterpret(card.value);
+ });
+ if (handValue > 21) {
+ console.log('bust');
+ return true;
+ }
+ return false;
+ }
+}
+//# sourceMappingURL=BlackJackPlayer.js.map
\ No newline at end of file
diff --git a/js/BlackJackPlayer.js.map b/js/BlackJackPlayer.js.map
new file mode 100644
index 00000000..5a6e999f
--- /dev/null
+++ b/js/BlackJackPlayer.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"BlackJackPlayer.js","sourceRoot":"","sources":["../ts/BlackJackPlayer.ts"],"names":[],"mappings":"AAAA;IAKI,YAAY,OAAe;QAH3B,SAAI,GAAe,EAAE,CAAC;QACtB,SAAI,GAAW,KAAK,CAAC;QAGjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,aAAa;QACT,IAAI,SAAS,GAAW,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrB,SAAS,IAAI,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,gBAAgB,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAA;QACtD,MAAM,CAAC,SAAS,CAAC;IACrB,CAAC;IAED,SAAS;QACL,IAAI,SAAS,GAAW,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrB,SAAS,IAAI,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YACnB,MAAM,CAAC,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;CACJ"}
\ No newline at end of file
diff --git a/js/CardGame.js b/js/CardGame.js
new file mode 100644
index 00000000..084b6c6f
--- /dev/null
+++ b/js/CardGame.js
@@ -0,0 +1,22 @@
+class CardGame {
+ static cardValueInterpret(valueToInterpret) {
+ if (valueToInterpret == 'J' || valueToInterpret == 'Q' || valueToInterpret == 'K') {
+ return 10;
+ }
+ else if (valueToInterpret == 'A') {
+ return 11;
+ }
+ else {
+ return parseInt(valueToInterpret);
+ }
+ }
+ static shuffle(array) {
+ for (var i = array.length - 1; i > 0; i--) {
+ var j = Math.floor(Math.random() * (i + 1));
+ var temp = array[i];
+ array[i] = array[j];
+ array[j] = temp;
+ }
+ }
+}
+//# sourceMappingURL=CardGame.js.map
\ No newline at end of file
diff --git a/js/CardGame.js.map b/js/CardGame.js.map
new file mode 100644
index 00000000..e2a25e7f
--- /dev/null
+++ b/js/CardGame.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"CardGame.js","sourceRoot":"","sources":["../ts/CardGame.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,CAAC,kBAAkB,CAAC,gBAAwB;QAC9C,EAAE,CAAC,CAAC,gBAAgB,IAAI,GAAG,IAAI,gBAAgB,IAAI,GAAG,IAAI,gBAAgB,IAAI,GAAG,CAAC,CAAC,CAAC;YAChF,MAAM,CAAC,EAAE,CAAC;QACd,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,gBAAgB,IAAI,GAAG,CAAC,CAAC,CAAC;YACjC,MAAM,CAAC,EAAE,CAAC;QACd,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,KAAK;QAChB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACpB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACpB,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QACpB,CAAC;IACL,CAAC;CACJ"}
\ No newline at end of file
diff --git a/js/CoinFlip.js b/js/CoinFlip.js
new file mode 100644
index 00000000..1c8ef160
--- /dev/null
+++ b/js/CoinFlip.js
@@ -0,0 +1,13 @@
+class CoinFlip {
+ constructor() { }
+ flipCoin() {
+ let flipResult = Math.floor(Math.random() * 2);
+ if (flipResult == 1) {
+ addToDisplayText('Heads!');
+ }
+ else {
+ addToDisplayText('Tails!');
+ }
+ }
+}
+//# sourceMappingURL=CoinFlip.js.map
\ No newline at end of file
diff --git a/js/CoinFlip.js.map b/js/CoinFlip.js.map
new file mode 100644
index 00000000..64b0d185
--- /dev/null
+++ b/js/CoinFlip.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"CoinFlip.js","sourceRoot":"","sources":["../ts/CoinFlip.ts"],"names":[],"mappings":"AAAA;IACI,gBAAc,CAAC;IACf,QAAQ;QACJ,IAAI,UAAU,GAAW,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QACvD,EAAE,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;CACJ"}
\ No newline at end of file
diff --git a/js/Game.js b/js/Game.js
new file mode 100644
index 00000000..9164374d
--- /dev/null
+++ b/js/Game.js
@@ -0,0 +1 @@
+//# sourceMappingURL=Game.js.map
\ No newline at end of file
diff --git a/js/Game.js.map b/js/Game.js.map
new file mode 100644
index 00000000..92f7f984
--- /dev/null
+++ b/js/Game.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"Game.js","sourceRoot":"","sources":["../ts/Game.ts"],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/js/Horse.js b/js/Horse.js
new file mode 100644
index 00000000..d28cd83f
--- /dev/null
+++ b/js/Horse.js
@@ -0,0 +1,13 @@
+class Horse {
+ constructor(name, speed) {
+ this.name = name;
+ this.baseSpeed = speed;
+ this.payout = (3 - this.baseSpeed);
+ }
+ run() {
+ this.raceSpeed = (Math.random() * this.baseSpeed);
+ console.log(this.name + " ran at " + this.raceSpeed);
+ return this.raceSpeed;
+ }
+}
+//# sourceMappingURL=Horse.js.map
\ No newline at end of file
diff --git a/js/Horse.js.map b/js/Horse.js.map
new file mode 100644
index 00000000..b9a74548
--- /dev/null
+++ b/js/Horse.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"Horse.js","sourceRoot":"","sources":["../ts/Horse.ts"],"names":[],"mappings":"AAAA;IAMI,YAAY,IAAW,EAAE,KAAY;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,GAAG;QACC,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;QACrD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;CACJ"}
\ No newline at end of file
diff --git a/js/HorseRace.js b/js/HorseRace.js
new file mode 100644
index 00000000..2492f674
--- /dev/null
+++ b/js/HorseRace.js
@@ -0,0 +1,84 @@
+class HorseRace {
+ constructor(profile) {
+ this.hoof = new Horse('Hoof Master', 1.4);
+ this.bonafide = new Horse('Bonafide', 1.2);
+ this.grifter = new Horse('Grifter', 1.0);
+ this.slowLoris = new Horse('Slow Loris', 0.7);
+ this.laggy = new Horse('Laggy', 0.5);
+ this.horses = [this.hoof, this.bonafide, this.grifter, this.slowLoris, this.laggy];
+ this.profile = profile;
+ addToDisplayText('Welcome to the Race Track!');
+ }
+ begin() {
+ console.log('starting balance of ' + this.profile.getChips);
+ console.log('begin horse race');
+ addToDisplayText('Select your horse. Your options are:');
+ addToDisplayText('Hoof Master: Highest Speed, Lowest Payout');
+ addToDisplayText('Bonafide: High Speed, Low Payout');
+ addToDisplayText('Grifter: Medium Speed, Medium Payout');
+ addToDisplayText('Slow Loris: Low Speed, High Payout');
+ addToDisplayText('Laggy: Lowest speed, Highest payout');
+ btn.addEventListener('click', (e) => this.pickHorse(), { once: true });
+ }
+ pickHorse() {
+ clearInput();
+ switch (userInput.toLowerCase()) {
+ case 'hoof master':
+ this.selectedHorse = this.hoof;
+ break;
+ case 'bonafide':
+ this.selectedHorse = this.bonafide;
+ break;
+ case 'grifter':
+ this.selectedHorse = this.grifter;
+ break;
+ case 'slow loris':
+ this.selectedHorse = this.slowLoris;
+ break;
+ case 'laggy':
+ this.selectedHorse = this.laggy;
+ break;
+ default:
+ addToDisplayText('Invalid Selection');
+ btn.addEventListener('click', (e) => this.pickHorse(), { once: true });
+ return;
+ }
+ console.log(this.selectedHorse);
+ addToDisplayText(this.selectionMessage(this.selectedHorse));
+ addToDisplayText('Please place your bet');
+ btn.addEventListener('click', (e) => this.acceptBet(), { once: true });
+ }
+ acceptBet() {
+ this.bet = parseInt(userInput);
+ addToDisplayText('You have bet ' + this.bet);
+ this.race();
+ }
+ selectionMessage(horse) {
+ return 'You have selected ' + horse.name;
+ }
+ race() {
+ let winnerSpeed = 0;
+ let winnerHorse;
+ this.horses.forEach(horse => {
+ horse.run();
+ console.log(horse.name + " ran at " + horse.raceSpeed);
+ if (horse.raceSpeed > winnerSpeed) {
+ winnerSpeed = horse.raceSpeed;
+ winnerHorse = horse;
+ }
+ });
+ if (this.selectedHorse == winnerHorse) {
+ let winnings = this.bet * winnerHorse.payout;
+ addToDisplayText('Your horse wins! You win ' + winnings + ' chips!');
+ this.profile.addChips(winnings);
+ console.log(winnings + 'won');
+ }
+ else {
+ addToDisplayText('You lose!');
+ this.profile.subtractChips(this.bet);
+ }
+ console.log('new balance of ' + this.profile.getChips);
+ addToDisplayText('Your new balance is ' + this.profile.getChips);
+ }
+}
+//# sourceMappingURL=HorseRace.js.map
\ No newline at end of file
diff --git a/js/HorseRace.js.map b/js/HorseRace.js.map
new file mode 100644
index 00000000..b69e0797
--- /dev/null
+++ b/js/HorseRace.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"HorseRace.js","sourceRoot":"","sources":["../ts/HorseRace.ts"],"names":[],"mappings":"AAAA;IAWI,YAAY,OAAe;QAP3B,SAAI,GAAG,IAAI,KAAK,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QACrC,aAAQ,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACtC,YAAO,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QACpC,cAAS,GAAG,IAAI,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QACzC,UAAK,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAChC,WAAM,GAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ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AAC,CAAC,CAAC;gBAChC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC;gBAC9B,WAAW,GAAG,KAAK,CAAC;YACxB,CAAC;QACL,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,WAAW,CAAC,CAAC,CAAC;YACpC,IAAI,QAAQ,GAAU,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC;YACpD,gBAAgB,CAAC,2BAA2B,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;YACrE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC;QAClC,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,gBAAgB,CAAC,WAAW,CAAC,CAAC;YAC9B,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QACtD,gBAAgB,CAAC,sBAAsB,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrE,CAAC;CACJ"}
\ No newline at end of file
diff --git a/js/MainMenu.js b/js/MainMenu.js
new file mode 100644
index 00000000..a9e19b36
--- /dev/null
+++ b/js/MainMenu.js
@@ -0,0 +1,56 @@
+class MainMenu {
+ constructor() {
+ this.getNameEvent = (e) => this.getName();
+ this.getFundsEvent = (e) => this.getInitialFunds();
+ this.gameChoice = (e) => this.getGameChoice();
+ }
+ profileSetup() {
+ btn.addEventListener('click', this.getNameEvent, { once: true });
+ addToDisplayText('Please enter your name');
+ }
+ getName() {
+ this.name = userInput;
+ clearInput();
+ btn.addEventListener('click', this.getFundsEvent, { once: true });
+ addToDisplayText('Hello ' + this.name + '\nHow many chips would you like?');
+ }
+ getInitialFunds() {
+ this.initialFunds = parseInt(userInput);
+ clearInput();
+ this.profile = new Profile(this.name, this.initialFunds);
+ btn.addEventListener('click', this.gameChoice, { once: true });
+ addToDisplayText('Alright, you\'ll start at ' + this.initialFunds);
+ addToDisplayText('Which game would you like to play? We\'ve got\n - BlackJack\n - Horse Racing');
+ }
+ getGameChoice() {
+ let choice = userInput;
+ if (choice.toLowerCase() == 'blackjack') {
+ this.blackJackTurn();
+ }
+ else if (choice.toLowerCase() == 'secret') {
+ addToDisplayText('oh no i forgot to add a text game');
+ clearInput();
+ }
+ else if (choice.toLowerCase() == 'horse') {
+ this.beginHorseRace();
+ }
+ else {
+ clearInput();
+ addToDisplayText('Invalid input, please try again.');
+ addToDisplayText('Which game would you like to play? We\'ve got\n - BlackJack');
+ btn.addEventListener('click', this.gameChoice, { once: true });
+ }
+ }
+ blackJackTurn() {
+ let blackjack = new BlackJack(this.profile);
+ clearInput();
+ blackjack.updateInput();
+ btn.addEventListener("click", (e) => blackjack.updateInput());
+ }
+ beginHorseRace() {
+ let horseRace = new HorseRace(this.profile);
+ clearInput();
+ horseRace.begin();
+ }
+}
+//# sourceMappingURL=MainMenu.js.map
\ No newline at end of file
diff --git a/js/MainMenu.js.map b/js/MainMenu.js.map
new file mode 100644
index 00000000..d2c9cc8c
--- /dev/null
+++ b/js/MainMenu.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"MainMenu.js","sourceRoot":"","sources":["../ts/MainMenu.ts"],"names":[],"mappings":"AAAA;IACI;QAIA,iBAAY,GAAG,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5C,kBAAa,GAAG,CAAC,CAAO,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;QACpD,eAAU,GAAG,CAAC,CAAO,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;IANjC,CAAC;IAQf,YAAY;QACR,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAA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CAAC,CAAC,CAAC;YACzC,IAAI,CAAC,cAAc,EAAE,CAAC;QAC1B,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,UAAU,EAAE,CAAC;YACb,gBAAgB,CAAC,kCAAkC,CAAC,CAAA;YACpD,gBAAgB,CAAC,6DAA6D,CAAC,CAAA;YAC/E,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;QAClE,CAAC;IACL,CAAC;IAED,aAAa;QACT,IAAI,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,UAAU,EAAE,CAAC;QACb,SAAS,CAAC,WAAW,EAAE,CAAC;QACxB,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,cAAc;QACV,IAAI,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,UAAU,EAAE,CAAC;QACb,SAAS,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CAEJ"}
\ No newline at end of file
diff --git a/js/Profile.js b/js/Profile.js
new file mode 100644
index 00000000..5b77cdce
--- /dev/null
+++ b/js/Profile.js
@@ -0,0 +1,22 @@
+class Profile {
+ constructor(name, chips) {
+ this.name = name;
+ this.chips = chips;
+ }
+ get getName() {
+ return this.name;
+ }
+ get getChips() {
+ return this.chips;
+ }
+ set setName(v) {
+ this.name = v;
+ }
+ addChips(bet) {
+ this.chips += bet;
+ }
+ subtractChips(bet) {
+ this.chips -= bet;
+ }
+}
+//# sourceMappingURL=Profile.js.map
\ No newline at end of file
diff --git a/js/Profile.js.map b/js/Profile.js.map
new file mode 100644
index 00000000..d5644a5c
--- /dev/null
+++ b/js/Profile.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"Profile.js","sourceRoot":"","sources":["../ts/Profile.ts"],"names":[],"mappings":"AAAA;IAGI,YAAY,IAAW,EAAE,KAAY;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAGD,IAAW,OAAO;QACd,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,IAAW,QAAQ;QACf,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAGD,IAAW,OAAO,CAAC,CAAU;QACzB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAClB,CAAC;IAEM,QAAQ,CAAC,GAAU;QACtB,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC;IACtB,CAAC;IAEM,aAAa,CAAC,GAAU;QAC3B,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC;IACtB,CAAC;CAEJ"}
\ No newline at end of file
diff --git a/js/app.js b/js/app.js
new file mode 100644
index 00000000..61b6f1c9
--- /dev/null
+++ b/js/app.js
@@ -0,0 +1,39 @@
+var el = document.getElementById('display');
+var title = document.getElementById('game_title');
+var shot = document.getElementById('drink');
+var overlay = document.getElementById('overlay');
+var body = document.getElementById('body');
+let userInput;
+let currentGame = false;
+let userName;
+let userFunds;
+let drinks = 0;
+function addToDisplayText(text) {
+ if (text != '') {
+ el.innerText += '\n';
+ el.innerText += text;
+ }
+}
+function setInput(newInput) {
+ userInput = newInput;
+}
+var btn = document.getElementById('submit');
+var startbtn = document.getElementById('start');
+var inputField = document.getElementById("user_input");
+btn.addEventListener("click", (e) => setInput(inputField.value));
+btn.addEventListener("click", (e) => addToDisplayText('you input ' + userInput));
+var flipper = document.getElementById('coinflip');
+var coinflipper = new CoinFlip();
+flipper.addEventListener('click', (e) => coinflipper.flipCoin());
+shot.addEventListener('click', (e) => takeShot());
+function takeShot() {
+ drinks += 1;
+ body.style.webkitFilter = "blur(" + drinks + "px)";
+}
+function clearInput() {
+ inputField.value = '';
+}
+let mainMenu = new MainMenu();
+mainMenu.profileSetup();
+// blackJackTurn();
+//# sourceMappingURL=app.js.map
\ No newline at end of file
diff --git a/js/app.js.map b/js/app.js.map
new file mode 100644
index 00000000..d5bccd03
--- /dev/null
+++ b/js/app.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"app.js","sourceRoot":"","sources":["../ts/app.ts"],"names":[],"mappings":"AAAA,IAAI,EAAE,GAAgB,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AACzD,IAAI,KAAK,GAAgB,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;AAC/D,IAAI,IAAI,GAAe,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACxD,IAAI,OAAO,GAAe,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAe,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AAEvD,IAAI,SAAgB,CAAC;AACrB,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,IAAI,QAAe,CAAC;AACpB,IAAI,SAAgB,CAAC;AACrB,IAAI,MAAM,GAAU,CAAC,CAAC;AAEtB,0BAA0B,IAAY;IAClC,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;QACb,EAAE,CAAC,SAAS,IAAI,IAAI,CAAC;QACrB,EAAE,CAAC,SAAS,IAAI,IAAI,CAAC;IACzB,CAAC;AACL,CAAC;AAED,kBAAkB,QAAe;IAC7B,SAAS,GAAG,QAAQ,CAAC;AACzB,CAAC;AAED,IAAI,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC5C,IAAI,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AAChD,IAAI,UAAU,GAAuC,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;AAC3F,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AACxE,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC;AAEvF,IAAI,OAAO,GAAe,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;AAC7D,IAAI,WAAW,GAAY,IAAI,QAAQ,EAAE,CAAC;AAC1C,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAO,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEvE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAO,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;AACxD;IACI,MAAM,IAAI,CAAC,CAAA;IACX,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,OAAO,GAAE,MAAM,GAAE,KAAK,CAAC;AACrD,CAAC;AAED;IACI,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC;AAC1B,CAAC;AAED,IAAI,QAAQ,GAAY,IAAI,QAAQ,EAAE,CAAC;AACvC,QAAQ,CAAC,YAAY,EAAE,CAAC;AAExB,mBAAmB"}
\ No newline at end of file
diff --git a/js/card.js b/js/card.js
new file mode 100644
index 00000000..242412b6
--- /dev/null
+++ b/js/card.js
@@ -0,0 +1,7 @@
+class Card {
+ constructor(value, suit) {
+ this.value = value;
+ this.suit = suit;
+ }
+}
+//# sourceMappingURL=card.js.map
\ No newline at end of file
diff --git a/js/card.js.map b/js/card.js.map
new file mode 100644
index 00000000..eac58280
--- /dev/null
+++ b/js/card.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"card.js","sourceRoot":"","sources":["../ts/card.ts"],"names":[],"mappings":"AAAA;IAGI,YAAY,KAAa,EAAE,IAAY;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ"}
\ No newline at end of file
diff --git a/js/dealer.js b/js/dealer.js
new file mode 100644
index 00000000..8ddea204
--- /dev/null
+++ b/js/dealer.js
@@ -0,0 +1,46 @@
+class dealer {
+ constructor(game) {
+ this.hand = [];
+ this.bust = false;
+ this.game = game;
+ }
+ dealerTurn() {
+ while (this.calcHandValue() < 17) {
+ addToDisplayText('Dealer hand value at ' + this.calcHandValue());
+ this.game.dealerDraw(true);
+ if (this.bustCheck()) {
+ addToDisplayText('Dealer busts!');
+ this.bust = true;
+ }
+ addToDisplayText('Dealer final hand value at ' + this.calcHandValue());
+ }
+ }
+ calcHandValue() {
+ let handValue = 0;
+ this.hand.forEach(card => {
+ handValue += CardGame.cardValueInterpret(card.value);
+ });
+ addToDisplayText('Current hand value is ' + handValue);
+ return handValue;
+ }
+ bustCheck() {
+ let handValue = 0;
+ this.hand.forEach(card => {
+ handValue += CardGame.cardValueInterpret(card.value);
+ });
+ if (handValue > 21) {
+ console.log('bust');
+ return true;
+ }
+ return false;
+ }
+ aceAdjust() {
+ this.hand.forEach(element => {
+ if (element.value == 'A') {
+ return true;
+ }
+ });
+ return false;
+ }
+}
+//# sourceMappingURL=dealer.js.map
\ No newline at end of file
diff --git a/js/dealer.js.map b/js/dealer.js.map
new file mode 100644
index 00000000..11160c11
--- /dev/null
+++ b/js/dealer.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"dealer.js","sourceRoot":"","sources":["../ts/dealer.ts"],"names":[],"mappings":"AAAA;IAKI,YAAY,IAAc;QAJ1B,SAAI,GAAe,EAAE,CAAC;QACtB,SAAI,GAAW,KAAK,CAAC;QAIjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,aAAa,EAAE,GAAG,EAAE,EAAE,CAAC;YAC/B,gBAAgB,CAAC,uBAAuB,GAAG,IAA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QACL,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;CACJ"}
\ No newline at end of file
diff --git a/js/deck.js b/js/deck.js
new file mode 100644
index 00000000..047d0e35
--- /dev/null
+++ b/js/deck.js
@@ -0,0 +1,19 @@
+class Deck {
+ constructor() {
+ this.CardValues = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'];
+ this.CardSuits = ['Hearts', 'Clubs', 'Diamonds', 'Spades'];
+ this.cards = [];
+ for (var i = 0; i < 4; i++) {
+ for (var j = 0; j < 13; j++) {
+ let tempCard = new Card(this.CardValues[j], this.CardSuits[i]);
+ this.cards.push(tempCard);
+ // console.log(tempCard.value + " of " + tempCard.suit)
+ }
+ }
+ CardGame.shuffle(this.cards);
+ // for (var k = 0; k < 52; k++){
+ // console.log(this.cards[k].value + " of " + this.cards[k].suit + " value of " + cardValueInterpret(this.cards[k].value))
+ // }
+ }
+}
+//# sourceMappingURL=deck.js.map
\ No newline at end of file
diff --git a/js/deck.js.map b/js/deck.js.map
new file mode 100644
index 00000000..d4ed20c8
--- /dev/null
+++ b/js/deck.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"deck.js","sourceRoot":"","sources":["../ts/deck.ts"],"names":[],"mappings":"AAAA;IAKI;QAJA,eAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAChF,cAAS,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QAEtD,UAAK,GAAgB,EAAE,CAAC;QAEpB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC1B,IAAI,QAAQ,GAAS,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC1B,uDAAuD;YAC3D,CAAC;QACL,CAAC;QACD,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,gCAAgC;QAChC,8HAA8H;QAC9H,IAAI;IACR,CAAC;CACJ"}
\ No newline at end of file
diff --git a/node_modules/.bin/he b/node_modules/.bin/he
new file mode 120000
index 00000000..2a8eb5e0
--- /dev/null
+++ b/node_modules/.bin/he
@@ -0,0 +1 @@
+../he/bin/he
\ No newline at end of file
diff --git a/node_modules/.bin/httpserver b/node_modules/.bin/httpserver
new file mode 120000
index 00000000..6f224744
--- /dev/null
+++ b/node_modules/.bin/httpserver
@@ -0,0 +1 @@
+../httpserver/httpserver.js
\ No newline at end of file
diff --git a/node_modules/.bin/latest b/node_modules/.bin/latest
new file mode 120000
index 00000000..f2bf8d17
--- /dev/null
+++ b/node_modules/.bin/latest
@@ -0,0 +1 @@
+../latest/bin/latest.js
\ No newline at end of file
diff --git a/node_modules/.bin/mkdirp b/node_modules/.bin/mkdirp
new file mode 120000
index 00000000..017896ce
--- /dev/null
+++ b/node_modules/.bin/mkdirp
@@ -0,0 +1 @@
+../mkdirp/bin/cmd.js
\ No newline at end of file
diff --git a/node_modules/.bin/nopt b/node_modules/.bin/nopt
new file mode 120000
index 00000000..6b6566ea
--- /dev/null
+++ b/node_modules/.bin/nopt
@@ -0,0 +1 @@
+../nopt/bin/nopt.js
\ No newline at end of file
diff --git a/node_modules/.bin/npm b/node_modules/.bin/npm
new file mode 120000
index 00000000..e8043340
--- /dev/null
+++ b/node_modules/.bin/npm
@@ -0,0 +1 @@
+../npm/bin/npm-cli.js
\ No newline at end of file
diff --git a/node_modules/.bin/rimraf b/node_modules/.bin/rimraf
new file mode 120000
index 00000000..4cd49a49
--- /dev/null
+++ b/node_modules/.bin/rimraf
@@ -0,0 +1 @@
+../rimraf/bin.js
\ No newline at end of file
diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver
new file mode 120000
index 00000000..317eb293
--- /dev/null
+++ b/node_modules/.bin/semver
@@ -0,0 +1 @@
+../semver/bin/semver
\ No newline at end of file
diff --git a/node_modules/abbrev/LICENSE b/node_modules/abbrev/LICENSE
new file mode 100644
index 00000000..9bcfa9d7
--- /dev/null
+++ b/node_modules/abbrev/LICENSE
@@ -0,0 +1,46 @@
+This software is dual-licensed under the ISC and MIT licenses.
+You may use this software under EITHER of the following licenses.
+
+----------
+
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter and Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+----------
+
+Copyright Isaac Z. Schlueter and Contributors
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/abbrev/README.md b/node_modules/abbrev/README.md
new file mode 100644
index 00000000..99746fe6
--- /dev/null
+++ b/node_modules/abbrev/README.md
@@ -0,0 +1,23 @@
+# abbrev-js
+
+Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
+
+Usage:
+
+ var abbrev = require("abbrev");
+ abbrev("foo", "fool", "folding", "flop");
+
+ // returns:
+ { fl: 'flop'
+ , flo: 'flop'
+ , flop: 'flop'
+ , fol: 'folding'
+ , fold: 'folding'
+ , foldi: 'folding'
+ , foldin: 'folding'
+ , folding: 'folding'
+ , foo: 'foo'
+ , fool: 'fool'
+ }
+
+This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
diff --git a/node_modules/abbrev/abbrev.js b/node_modules/abbrev/abbrev.js
new file mode 100644
index 00000000..7b1dc5d6
--- /dev/null
+++ b/node_modules/abbrev/abbrev.js
@@ -0,0 +1,61 @@
+module.exports = exports = abbrev.abbrev = abbrev
+
+abbrev.monkeyPatch = monkeyPatch
+
+function monkeyPatch () {
+ Object.defineProperty(Array.prototype, 'abbrev', {
+ value: function () { return abbrev(this) },
+ enumerable: false, configurable: true, writable: true
+ })
+
+ Object.defineProperty(Object.prototype, 'abbrev', {
+ value: function () { return abbrev(Object.keys(this)) },
+ enumerable: false, configurable: true, writable: true
+ })
+}
+
+function abbrev (list) {
+ if (arguments.length !== 1 || !Array.isArray(list)) {
+ list = Array.prototype.slice.call(arguments, 0)
+ }
+ for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
+ args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
+ }
+
+ // sort them lexicographically, so that they're next to their nearest kin
+ args = args.sort(lexSort)
+
+ // walk through each, seeing how much it has in common with the next and previous
+ var abbrevs = {}
+ , prev = ""
+ for (var i = 0, l = args.length ; i < l ; i ++) {
+ var current = args[i]
+ , next = args[i + 1] || ""
+ , nextMatches = true
+ , prevMatches = true
+ if (current === next) continue
+ for (var j = 0, cl = current.length ; j < cl ; j ++) {
+ var curChar = current.charAt(j)
+ nextMatches = nextMatches && curChar === next.charAt(j)
+ prevMatches = prevMatches && curChar === prev.charAt(j)
+ if (!nextMatches && !prevMatches) {
+ j ++
+ break
+ }
+ }
+ prev = current
+ if (j === cl) {
+ abbrevs[current] = current
+ continue
+ }
+ for (var a = current.substr(0, j) ; j <= cl ; j ++) {
+ abbrevs[a] = current
+ a += current.charAt(j)
+ }
+ }
+ return abbrevs
+}
+
+function lexSort (a, b) {
+ return a === b ? 0 : a > b ? 1 : -1
+}
diff --git a/node_modules/abbrev/package.json b/node_modules/abbrev/package.json
new file mode 100644
index 00000000..a8afbc9c
--- /dev/null
+++ b/node_modules/abbrev/package.json
@@ -0,0 +1,56 @@
+{
+ "_from": "abbrev@1",
+ "_id": "abbrev@1.1.1",
+ "_inBundle": false,
+ "_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
+ "_location": "/abbrev",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "abbrev@1",
+ "name": "abbrev",
+ "escapedName": "abbrev",
+ "rawSpec": "1",
+ "saveSpec": null,
+ "fetchSpec": "1"
+ },
+ "_requiredBy": [
+ "/nopt"
+ ],
+ "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
+ "_shasum": "f8f2c887ad10bf67f634f005b6987fed3179aac8",
+ "_spec": "abbrev@1",
+ "_where": "/Users/patrickglavin/Dev/fourth_hex/TSCasino/node_modules/nopt",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me"
+ },
+ "bugs": {
+ "url": "https://github.com/isaacs/abbrev-js/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Like ruby's abbrev module, but in js",
+ "devDependencies": {
+ "tap": "^10.1"
+ },
+ "files": [
+ "abbrev.js"
+ ],
+ "homepage": "https://github.com/isaacs/abbrev-js#readme",
+ "license": "ISC",
+ "main": "abbrev.js",
+ "name": "abbrev",
+ "repository": {
+ "type": "git",
+ "url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
+ },
+ "scripts": {
+ "postpublish": "git push origin --all; git push origin --tags",
+ "postversion": "npm publish",
+ "preversion": "npm test",
+ "test": "tap test.js --100"
+ },
+ "version": "1.1.1"
+}
diff --git a/node_modules/access-log/.npmignore b/node_modules/access-log/.npmignore
new file mode 100644
index 00000000..3c3629e6
--- /dev/null
+++ b/node_modules/access-log/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/access-log/README.md b/node_modules/access-log/README.md
new file mode 100644
index 00000000..76c49d13
--- /dev/null
+++ b/node_modules/access-log/README.md
@@ -0,0 +1,109 @@
+access-log
+==========
+
+Add simple access logs to any http or https server
+
+Usage
+-----
+
+``` js
+var http = require('http');
+var accesslog = require('access-log');
+
+http.createServer(function(req, res) {
+ accesslog(req, res);
+ res.end();
+}).listen(80, '0.0.0.0');
+```
+
+This will automatically log requests as they come in to the
+web server that look like...
+
+```
+127.0.0.1 - - [13/Sep/2013:01:38:09 -0400] "GET / HTTP/1.1" 200 - "-" "-"
+127.0.0.1 - - [13/Sep/2013:01:38:09 -0400] "GET /testing HTTP/1.1" 200 - "-" "-"
+127.0.0.1 - - [13/Sep/2013:01:38:10 -0400] "GET /index.html HTTP/1.1" 200 - "-" "-"
+```
+
+Customization
+-------------
+
+### accesslog(req, res, [format], [function])
+
+#### format
+
+You can pass in a format string, the default is Apache Common Log Format
+http://en.wikipedia.org/wiki/Common_Log_Format
+
+```
+:ip - :userID [:clfDate] ":method :url :protocol/:httpVersion" :statusCode :contentLength ":referer" ":userAgent"
+```
+
+- `clfDate`: The date of the end of the response in Apache Common Log format
+- `contentLength`: The response `Content-Length` header, or `-` if unset
+- `delta`: The time in ms from request to response
+- `endDate`: The ISO formatted string when the response was ended
+- `endTime`: The epoch time when the response was ended
+- `host`: The host header from the request if set
+- `httpVersion`: The HTTP version used (ie. `1.0`, `1.1`)
+- `ip`: The remote IP
+- `Xip`: The remote IP, using `X-Forwarded-For` if set
+- `method`: The HTTP method
+- `protocol`: `HTTP` or `HTTPS`
+- `referer`: The request `Referer` header, or `-` if unset
+- `startDate`: The ISO formatted string when the request was received
+- `startTime`: The epoch time when the request was received
+- `statusCode`: The response status code sent from the server
+- `url`: The requested URL
+- `urlDecoded`: The decoded request URL (ie. `%20` => ` `)
+- `userID`: The username if applicable
+- `userAgent`: The request `User-Agent` header, or `-` if unset
+
+**NOTE:** Wrap variables in `{}` to protect against unwanted interpolation.
+
+ex:
+
+```
+request to :url took :{delta}ms
+```
+
+#### function
+
+You can also pass in your own custom callback, the default is `console.log`.
+The only argument passed is the access log string
+
+Example
+-------
+
+``` js
+var format = 'url=":url" method=":method" statusCode=":statusCode" delta=":delta" ip=":ip"';
+
+accesslog(req, res, format, function(s) {
+ console.log(s);
+});
+```
+
+yields
+
+```
+url="/projects" method="GET" statusCode="200" delta="0" ip="127.0.0.1"
+url="/testing" method="GET" statusCode="200" delta="1" ip="127.0.0.1"
+url="/index.html" method="GET" statusCode="200" delta="0" ip="127.0.0.1"
+```
+
+Installation
+------------
+
+ npm install access-log
+
+Extend
+------
+
+Consider further customizing the access logs by using the [log-timestamp]
+(https://github.com/bahamas10/node-log-timestamp) module to prepend a timestamp
+automatically.
+
+License
+-------
+
+MIT Licensed
diff --git a/node_modules/access-log/examples/cb.js b/node_modules/access-log/examples/cb.js
new file mode 100644
index 00000000..7b6899a8
--- /dev/null
+++ b/node_modules/access-log/examples/cb.js
@@ -0,0 +1,11 @@
+var http = require('http');
+var accesslog = require('../');
+
+http.createServer(function(req, res) {
+ accesslog(req, res, function(s) {
+ console.log('> ' + s + ' <');
+ });
+ res.end();
+}).listen(8000, 'localhost', function() {
+ console.log('Listening on localhost:8000');
+});
diff --git a/node_modules/access-log/examples/fancy.js b/node_modules/access-log/examples/fancy.js
new file mode 100644
index 00000000..23d4e06a
--- /dev/null
+++ b/node_modules/access-log/examples/fancy.js
@@ -0,0 +1,13 @@
+var http = require('http');
+var accesslog = require('../');
+
+var format = 'url=":url" method=":method" statusCode=":statusCode" delta=":delta" ip=":ip"';
+
+http.createServer(function(req, res) {
+ accesslog(req, res, format, function(s) {
+ console.log(s);
+ });
+ res.end();
+}).listen(8000, 'localhost', function() {
+ console.log('Listening on localhost:8000');
+});
diff --git a/node_modules/access-log/examples/simple.js b/node_modules/access-log/examples/simple.js
new file mode 100644
index 00000000..7db59edd
--- /dev/null
+++ b/node_modules/access-log/examples/simple.js
@@ -0,0 +1,9 @@
+var http = require('http');
+var accesslog = require('../');
+
+http.createServer(function(req, res) {
+ accesslog(req, res);
+ res.end();
+}).listen(8000, 'localhost', function() {
+ console.log('Listening on localhost:8000');
+});
diff --git a/node_modules/access-log/index.js b/node_modules/access-log/index.js
new file mode 100644
index 00000000..16b07605
--- /dev/null
+++ b/node_modules/access-log/index.js
@@ -0,0 +1,100 @@
+var strftime = require('strftime');
+
+var defaultformat = ':ip - :userID [:clfDate] ":method :url :protocol/:httpVersion" :statusCode :contentLength ":referer" ":userAgent"';
+
+module.exports = accesslog;
+
+function accesslog(req, res, format, cb) {
+ if (typeof format === 'function') {
+ cb = format;
+ format = null;
+ }
+
+ var remoteAddress = req.connection.remoteAddress;
+ var contentLength;
+ format = format || defaultformat;
+ cb = cb || console.log.bind(console);
+
+ var uriDecoded;
+ try {
+ uriDecoded = decodeURIComponent(req.url);
+ } catch (e) {
+ uriDecoded = e.message || 'error decoding URI';
+ }
+
+ var start = new Date();
+
+ // override res.writeHead to track contentLength
+ var resWriteHead = res.writeHead.bind(res);
+ res.writeHead = function(statusCode, reason, headers) {
+ var ret = resWriteHead.apply(res, arguments);
+
+ if (typeof reason === 'object' && !headers) {
+ headers = reason;
+ reason = null;
+ }
+
+ if (headers) {
+ Object.keys(headers).forEach(function(key) {
+ if (key.toLowerCase() === 'content-length')
+ contentLength = headers[key];
+ });
+ }
+
+ return ret;
+ };
+
+ // override res.end to capture all responses
+ var resend = res.end.bind(res);
+ res.end = function() {
+ // call the original
+ var ret = resend.apply(res, arguments);
+
+ var end = new Date();
+ var delta = end - start;
+ var userID;
+ try {
+ userID = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString().split(':')[0];
+ } catch(e) {}
+ var data = {
+ ':clfDate': strftime('%d/%b/%Y:%H:%M:%S %z', end),
+ ':contentLength': res.getHeader('content-length') || contentLength || '-',
+ ':delta': delta,
+ ':endDate': end.toISOString(),
+ ':endTime': end.getTime(),
+ ':host': encode(req.headers.host || '-'),
+ ':httpVersion': req.httpVersion,
+ ':ip': remoteAddress || '-',
+ ':Xip': encode(req.headers['x-forwarded-for'] || remoteAddress || '-'),
+ ':method': req.method,
+ ':protocol': req.connection.encrypted ? 'HTTPS' : 'HTTP',
+ ':referer': encode(req.headers.referer || '-'),
+ ':startDate': start.toISOString(),
+ ':startTime': start.getTime(),
+ ':statusCode': res.statusCode,
+ ':url': encode(req.url),
+ ':urlDecoded': encode(uriDecoded),
+ ':userID': encode(userID || '-'),
+ ':userAgent': encode(req.headers['user-agent'] || '-')
+ };
+
+ cb(template(format, data));
+
+ return ret;
+ };
+}
+
+// replace :variable and :{variable} in `s` with what's in `d`
+function template(s, d) {
+ s = s.replace(/(:[a-zA-Z]+)/g, function(match, key) {
+ return d[key] || '';
+ });
+ return s.replace(/:{([a-zA-Z]+)}/g, function(match, key) {
+ return d[':' + key] || '';
+ });
+}
+
+// make a string safe to put in double quotes in CLF
+function encode(s) {
+ return s.replace(/\\/g, '\\x5C').replace(/"/, '\\x22');
+}
diff --git a/node_modules/access-log/package.json b/node_modules/access-log/package.json
new file mode 100644
index 00000000..390714a8
--- /dev/null
+++ b/node_modules/access-log/package.json
@@ -0,0 +1,63 @@
+{
+ "_from": "access-log@~0.3.9",
+ "_id": "access-log@0.3.9",
+ "_inBundle": false,
+ "_integrity": "sha1-AcJpW6fn0y21KI7z8U5k1nGfOtE=",
+ "_location": "/access-log",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "access-log@~0.3.9",
+ "name": "access-log",
+ "escapedName": "access-log",
+ "rawSpec": "~0.3.9",
+ "saveSpec": null,
+ "fetchSpec": "~0.3.9"
+ },
+ "_requiredBy": [
+ "/httpserver"
+ ],
+ "_resolved": "https://registry.npmjs.org/access-log/-/access-log-0.3.9.tgz",
+ "_shasum": "01c2695ba7e7d32db5288ef3f14e64d6719f3ad1",
+ "_spec": "access-log@~0.3.9",
+ "_where": "/Users/patrickglavin/Dev/fourth_hex/TSCasino/node_modules/httpserver",
+ "author": {
+ "name": "Dave Eddy",
+ "email": "dave@daveeddy.com",
+ "url": "http://www.daveeddy.com"
+ },
+ "bin": {},
+ "bugs": {
+ "url": "https://github.com/bahamas10/node-access-log/issues"
+ },
+ "bundleDependencies": false,
+ "contributors": [],
+ "dependencies": {
+ "strftime": "~0.6.2"
+ },
+ "deprecated": false,
+ "description": "Add simple access logs to any http or https server",
+ "devDependencies": {},
+ "engines": {
+ "node": "*"
+ },
+ "homepage": "https://github.com/bahamas10/node-access-log#readme",
+ "keywords": [
+ "access",
+ "apache",
+ "clf",
+ "logs"
+ ],
+ "main": "./index.js",
+ "name": "access-log",
+ "optionalDependencies": {},
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/bahamas10/node-access-log.git"
+ },
+ "scripts": {
+ "test": "for f in test/*; do echo \"\n$f\"; node \"$f\" || exit 1; done; echo Passed; exit 0"
+ },
+ "version": "0.3.9"
+}
diff --git a/node_modules/access-log/test/advanced.js b/node_modules/access-log/test/advanced.js
new file mode 100644
index 00000000..2a2fa0b5
--- /dev/null
+++ b/node_modules/access-log/test/advanced.js
@@ -0,0 +1,44 @@
+var http = require('http');
+
+var accesslog = require('../');
+
+var host = '127.0.0.1';
+var port = 9127;
+
+var format = [
+ 'clfDate: :clfDate',
+ 'contentLength: :contentLength',
+ 'delta: :delta',
+ 'endDate: :endDate',
+ 'endTime: :endTime',
+ 'host: :host',
+ 'httpVersion: :httpVersion',
+ 'ip: :ip',
+ 'Xip: :Xip',
+ 'method: :method',
+ 'protocol: :protocol',
+ 'referer: :referer',
+ 'startDate: :startDate',
+ 'startTime: :startTime',
+ 'statusCode: :statusCode',
+ 'url: :url',
+ 'urlDecoded: :urlDecoded',
+ 'userID: :userID',
+ 'userAgent: :userAgent',
+].join('\n');
+
+http.createServer(onrequest).listen(port, host, started);
+
+function onrequest(req, res) {
+ accesslog(req, res, format);
+ res.end();
+}
+
+function started() {
+ console.log('server started');
+
+ var req = http.request('http://localhost:9127/testing', function() {
+ process.exit(0);
+ });
+ req.end();
+}
diff --git a/node_modules/access-log/test/bad-chars.js b/node_modules/access-log/test/bad-chars.js
new file mode 100644
index 00000000..3ad74619
--- /dev/null
+++ b/node_modules/access-log/test/bad-chars.js
@@ -0,0 +1,22 @@
+var http = require('http');
+
+var accesslog = require('../');
+
+var host = '127.0.0.1';
+var port = 9127;
+
+http.createServer(onrequest).listen(port, host, started);
+
+function onrequest(req, res) {
+ accesslog(req, res);
+ res.end();
+}
+
+function started() {
+ console.log('server started');
+
+ var req = http.request('http://localhost:9127/"double\'single\\backslash', function() {
+ process.exit(0);
+ });
+ req.end();
+}
diff --git a/node_modules/access-log/test/bad-format.js b/node_modules/access-log/test/bad-format.js
new file mode 100644
index 00000000..66a57f7b
--- /dev/null
+++ b/node_modules/access-log/test/bad-format.js
@@ -0,0 +1,24 @@
+var http = require('http');
+
+var accesslog = require('../');
+
+var host = '127.0.0.1';
+var port = 9127;
+
+var format = ':ip :method :statusCode :url (:{delta}ms)';
+
+http.createServer(onrequest).listen(port, host, started);
+
+function onrequest(req, res) {
+ accesslog(req, res, format);
+ res.end();
+}
+
+function started() {
+ console.log('server started');
+
+ var req = http.request('http://localhost:9127/PWN3D:userAgentPWN3D', function() {
+ process.exit(0);
+ });
+ req.end();
+}
diff --git a/node_modules/access-log/test/format.js b/node_modules/access-log/test/format.js
new file mode 100644
index 00000000..6d1393d8
--- /dev/null
+++ b/node_modules/access-log/test/format.js
@@ -0,0 +1,24 @@
+var http = require('http');
+
+var accesslog = require('../');
+
+var host = '127.0.0.1';
+var port = 9127;
+
+var format = ':ip :method :statusCode :url (:{delta}ms)';
+
+http.createServer(onrequest).listen(port, host, started);
+
+function onrequest(req, res) {
+ accesslog(req, res, format);
+ res.end();
+}
+
+function started() {
+ console.log('server started');
+
+ var req = http.request('http://localhost:9127/testing', function() {
+ process.exit(0);
+ });
+ req.end();
+}
diff --git a/node_modules/access-log/test/length.js b/node_modules/access-log/test/length.js
new file mode 100644
index 00000000..64967d86
--- /dev/null
+++ b/node_modules/access-log/test/length.js
@@ -0,0 +1,26 @@
+var http = require('http');
+
+var accesslog = require('../');
+
+var host = '127.0.0.1';
+var port = 9127;
+
+var data = 'hello world';
+var len = Buffer.byteLength(data, 'utf-8')
+
+http.createServer(onrequest).listen(port, host, started);
+
+function onrequest(req, res) {
+ accesslog(req, res);
+ res.writeHead(200, {'Content-Length': len});
+ res.end(data);
+}
+
+function started() {
+ console.log('server started');
+
+ var req = http.request('http://localhost:9127/testing', function() {
+ process.exit(0);
+ });
+ req.end();
+}
diff --git a/node_modules/access-log/test/simple.js b/node_modules/access-log/test/simple.js
new file mode 100644
index 00000000..a8982b2f
--- /dev/null
+++ b/node_modules/access-log/test/simple.js
@@ -0,0 +1,22 @@
+var http = require('http');
+
+var accesslog = require('../');
+
+var host = '127.0.0.1';
+var port = 9127;
+
+http.createServer(onrequest).listen(port, host, started);
+
+function onrequest(req, res) {
+ accesslog(req, res);
+ res.end();
+}
+
+function started() {
+ console.log('server started');
+
+ var req = http.request('http://localhost:9127/testing', function() {
+ process.exit(0);
+ });
+ req.end();
+}
diff --git a/node_modules/access-log/test/user.js b/node_modules/access-log/test/user.js
new file mode 100644
index 00000000..d9d33e9e
--- /dev/null
+++ b/node_modules/access-log/test/user.js
@@ -0,0 +1,22 @@
+var http = require('http');
+
+var accesslog = require('../');
+
+var host = '127.0.0.1';
+var port = 9127;
+
+http.createServer(onrequest).listen(port, host, started);
+
+function onrequest(req, res) {
+ accesslog(req, res);
+ res.end();
+}
+
+function started() {
+ console.log('server started');
+
+ var req = http.request('http://username@localhost:9127/testing', function() {
+ process.exit(0);
+ });
+ req.end();
+}
diff --git a/node_modules/ansicolors/LICENSE b/node_modules/ansicolors/LICENSE
new file mode 100644
index 00000000..41702c50
--- /dev/null
+++ b/node_modules/ansicolors/LICENSE
@@ -0,0 +1,23 @@
+Copyright 2013 Thorsten Lorenz.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/ansicolors/README.md b/node_modules/ansicolors/README.md
new file mode 100644
index 00000000..f3e9d070
--- /dev/null
+++ b/node_modules/ansicolors/README.md
@@ -0,0 +1,62 @@
+# ansicolors [](http://next.travis-ci.org/thlorenz/ansicolors)
+
+Functions that surround a string with ansicolor codes so it prints in color.
+
+In case you need styles, like `bold`, have a look at [ansistyles](https://github.com/thlorenz/ansistyles).
+
+## Installation
+
+ npm install ansicolors
+
+## Usage
+
+```js
+var colors = require('ansicolors');
+
+// foreground colors
+var redHerring = colors.red('herring');
+var blueMoon = colors.blue('moon');
+var brighBlueMoon = colors.brightBlue('moon');
+
+console.log(redHerring); // this will print 'herring' in red
+console.log(blueMoon); // this 'moon' in blue
+console.log(brightBlueMoon); // I think you got the idea
+
+// background colors
+console.log(colors.bgYellow('printed on yellow background'));
+console.log(colors.bgBrightBlue('printed on bright blue background'));
+
+// mixing background and foreground colors
+// below two lines have same result (order in which bg and fg are combined doesn't matter)
+console.log(colors.bgYellow(colors.blue('printed on yellow background in blue')));
+console.log(colors.blue(colors.bgYellow('printed on yellow background in blue')));
+```
+
+## Advanced API
+
+**ansicolors** allows you to access opening and closing escape sequences separately.
+
+```js
+var colors = require('ansicolors');
+
+function inspect(obj, depth) {
+ return require('util').inspect(obj, false, depth || 5, true);
+}
+
+console.log('open blue', inspect(colors.open.blue));
+console.log('close bgBlack', inspect(colors.close.bgBlack));
+
+// => open blue '\u001b[34m'
+// close bgBlack '\u001b[49m'
+```
+
+## Tests
+
+Look at the [tests](https://github.com/thlorenz/ansicolors/blob/master/test/ansicolors.js) to see more examples and/or run them via:
+
+ npm explore ansicolors && npm test
+
+## Alternatives
+
+**ansicolors** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool,
+I'd suggest to look at the [features](https://github.com/TooTallNate/ansi.js#features) of the [ansi module](https://github.com/TooTallNate/ansi.js).
diff --git a/node_modules/ansicolors/ansicolors.js b/node_modules/ansicolors/ansicolors.js
new file mode 100644
index 00000000..16b2586f
--- /dev/null
+++ b/node_modules/ansicolors/ansicolors.js
@@ -0,0 +1,65 @@
+// ColorCodes explained: http://www.termsys.demon.co.uk/vtansi.htm
+'use strict';
+
+var colorNums = {
+ white : 37
+ , black : 30
+ , blue : 34
+ , cyan : 36
+ , green : 32
+ , magenta : 35
+ , red : 31
+ , yellow : 33
+ , brightBlack : 90
+ , brightRed : 91
+ , brightGreen : 92
+ , brightYellow : 93
+ , brightBlue : 94
+ , brightMagenta : 95
+ , brightCyan : 96
+ , brightWhite : 97
+ }
+ , backgroundColorNums = {
+ bgBlack : 40
+ , bgRed : 41
+ , bgGreen : 42
+ , bgYellow : 43
+ , bgBlue : 44
+ , bgMagenta : 45
+ , bgCyan : 46
+ , bgWhite : 47
+ , bgBrightBlack : 100
+ , bgBrightRed : 101
+ , bgBrightGreen : 102
+ , bgBrightYellow : 103
+ , bgBrightBlue : 104
+ , bgBrightMagenta : 105
+ , bgBrightCyan : 106
+ , bgBrightWhite : 107
+ }
+ , open = {}
+ , close = {}
+ , colors = {}
+ ;
+
+Object.keys(colorNums).forEach(function (k) {
+ var o = open[k] = '\u001b[' + colorNums[k] + 'm';
+ var c = close[k] = '\u001b[39m';
+
+ colors[k] = function (s) {
+ return o + s + c;
+ };
+});
+
+Object.keys(backgroundColorNums).forEach(function (k) {
+ var o = open[k] = '\u001b[' + backgroundColorNums[k] + 'm';
+ var c = close[k] = '\u001b[49m';
+
+ colors[k] = function (s) {
+ return o + s + c;
+ };
+});
+
+module.exports = colors;
+colors.open = open;
+colors.close = close;
diff --git a/node_modules/ansicolors/package.json b/node_modules/ansicolors/package.json
new file mode 100644
index 00000000..b17d59b7
--- /dev/null
+++ b/node_modules/ansicolors/package.json
@@ -0,0 +1,55 @@
+{
+ "_from": "ansicolors@0.3.2",
+ "_id": "ansicolors@0.3.2",
+ "_inBundle": false,
+ "_integrity": "sha1-ZlWX3oap/+Oqm/vmyuXG6kJrSXk=",
+ "_location": "/ansicolors",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "ansicolors@0.3.2",
+ "name": "ansicolors",
+ "escapedName": "ansicolors",
+ "rawSpec": "0.3.2",
+ "saveSpec": null,
+ "fetchSpec": "0.3.2"
+ },
+ "_requiredBy": [
+ "/npm"
+ ],
+ "_resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz",
+ "_shasum": "665597de86a9ffe3aa9bfbe6cae5c6ea426b4979",
+ "_spec": "ansicolors@0.3.2",
+ "_where": "/Users/patrickglavin/Dev/fourth_hex/TSCasino/node_modules/npm",
+ "author": {
+ "name": "Thorsten Lorenz",
+ "email": "thlorenz@gmx.de",
+ "url": "thlorenz.com"
+ },
+ "bugs": {
+ "url": "https://github.com/thlorenz/ansicolors/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Functions that surround a string with ansicolor codes so it prints in color.",
+ "gitHead": "858847ca28e8b360d9b70eee0592700fa2ab087d",
+ "homepage": "https://github.com/thlorenz/ansicolors#readme",
+ "keywords": [
+ "ansi",
+ "colors",
+ "highlight",
+ "string"
+ ],
+ "license": "MIT",
+ "main": "ansicolors.js",
+ "name": "ansicolors",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/thlorenz/ansicolors.git"
+ },
+ "scripts": {
+ "test": "node test/*.js"
+ },
+ "version": "0.3.2"
+}
diff --git a/node_modules/ansicolors/test/ansicolors.js b/node_modules/ansicolors/test/ansicolors.js
new file mode 100644
index 00000000..49453930
--- /dev/null
+++ b/node_modules/ansicolors/test/ansicolors.js
@@ -0,0 +1,71 @@
+'use strict';
+
+var assert = require('assert')
+ , colors = require('..')
+ , open = colors.open
+ , close = colors.close
+
+console.log('Foreground colors ..');
+
+assert.equal(colors.white('printed in white'), '\u001b[37mprinted in white\u001b[39m');
+
+assert.equal(colors.black('printed in black'), '\u001b[30mprinted in black\u001b[39m');
+assert.equal(colors.brightBlack('printed in bright black'), '\u001b[90mprinted in bright black\u001b[39m');
+
+assert.equal(colors.green('printed in green'), '\u001b[32mprinted in green\u001b[39m');
+assert.equal(colors.brightGreen('printed in bright green'), '\u001b[92mprinted in bright green\u001b[39m');
+
+assert.equal(colors.red('printed in red'), '\u001b[31mprinted in red\u001b[39m');
+assert.equal(colors.brightRed('printed in bright red'), '\u001b[91mprinted in bright red\u001b[39m');
+
+console.log('OK');
+
+console.log('Background colors ..');
+
+assert.equal(
+ colors.bgBlack('printed with black background')
+ , '\u001b[40mprinted with black background\u001b[49m'
+);
+
+assert.equal(
+ colors.bgYellow('printed with yellow background')
+ , '\u001b[43mprinted with yellow background\u001b[49m'
+);
+assert.equal(
+ colors.bgBrightYellow('printed with bright yellow background')
+ , '\u001b[103mprinted with bright yellow background\u001b[49m'
+);
+
+assert.equal(
+ colors.bgWhite('printed with white background')
+ , '\u001b[47mprinted with white background\u001b[49m'
+);
+
+console.log('OK');
+
+console.log('Mixing background and foreground colors ..');
+
+assert.equal(
+ colors.blue(colors.bgYellow('printed in blue with yellow background'))
+ , '\u001b[34m\u001b[43mprinted in blue with yellow background\u001b[49m\u001b[39m'
+);
+assert.equal(
+ colors.bgYellow(colors.blue('printed in blue with yellow background again'))
+ , '\u001b[43m\u001b[34mprinted in blue with yellow background again\u001b[39m\u001b[49m'
+);
+
+console.log('OK');
+
+console.log('Open ...');
+
+assert.equal(open.black, '\u001b[30m');
+assert.equal(open.bgYellow, '\u001b[43m');
+
+console.log('OK');
+
+console.log('Close ...');
+
+assert.equal(close.black, '\u001b[39m');
+assert.equal(close.bgYellow, '\u001b[49m');
+
+console.log('OK');
diff --git a/node_modules/ansistyles/LICENSE b/node_modules/ansistyles/LICENSE
new file mode 100644
index 00000000..41702c50
--- /dev/null
+++ b/node_modules/ansistyles/LICENSE
@@ -0,0 +1,23 @@
+Copyright 2013 Thorsten Lorenz.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/ansistyles/README.md b/node_modules/ansistyles/README.md
new file mode 100644
index 00000000..e39b8dfb
--- /dev/null
+++ b/node_modules/ansistyles/README.md
@@ -0,0 +1,71 @@
+# ansistyles [](http://next.travis-ci.org/thlorenz/ansistyles)
+
+Functions that surround a string with ansistyle codes so it prints in style.
+
+In case you need colors, like `red`, have a look at [ansicolors](https://github.com/thlorenz/ansicolors).
+
+## Installation
+
+ npm install ansistyles
+
+## Usage
+
+```js
+var styles = require('ansistyles');
+
+console.log(styles.bright('hello world')); // prints hello world in 'bright' white
+console.log(styles.underline('hello world')); // prints hello world underlined
+console.log(styles.inverse('hello world')); // prints hello world black on white
+```
+
+## Combining with ansicolors
+
+Get the ansicolors module:
+
+ npm install ansicolors
+
+```js
+var styles = require('ansistyles')
+ , colors = require('ansicolors');
+
+ console.log(
+ // prints hello world underlined in blue on a green background
+ colors.bgGreen(colors.blue(styles.underline('hello world')))
+ );
+```
+
+## Tests
+
+Look at the [tests](https://github.com/thlorenz/ansistyles/blob/master/test/ansistyles.js) to see more examples and/or run them via:
+
+ npm explore ansistyles && npm test
+
+## More Styles
+
+As you can see from [here](https://github.com/thlorenz/ansistyles/blob/master/ansistyles.js#L4-L15), more styles are available,
+but didn't have any effect on the terminals that I tested on Mac Lion and Ubuntu Linux.
+
+I included them for completeness, but didn't show them in the examples because they seem to have no effect.
+
+### reset
+
+A style reset function is also included, please note however that this is not nestable.
+
+Therefore the below only underlines `hell` only, but not `world`.
+
+```js
+console.log(styles.underline('hell' + styles.reset('o') + ' world'));
+```
+
+It is essentially the same as:
+
+```js
+console.log(styles.underline('hell') + styles.reset('') + 'o world');
+```
+
+
+
+## Alternatives
+
+**ansistyles** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool,
+I'd suggest to look at the [features](https://github.com/TooTallNate/ansi.js#features) of the [ansi module](https://github.com/TooTallNate/ansi.js).
diff --git a/node_modules/ansistyles/ansistyles.js b/node_modules/ansistyles/ansistyles.js
new file mode 100644
index 00000000..5b8788c0
--- /dev/null
+++ b/node_modules/ansistyles/ansistyles.js
@@ -0,0 +1,38 @@
+'use strict';
+
+/*
+ * Info: http://www.termsys.demon.co.uk/vtansi.htm#colors
+ * Following caveats
+ * bright - brightens the color (bold-blue is same as brigthtBlue)
+ * dim - nothing on Mac or Linux
+ * italic - nothing on Mac or Linux
+ * underline - underlines string
+ * blink - nothing on Mac or linux
+ * inverse - background becomes foreground and vice versa
+ *
+ * In summary, the only styles that work are:
+ * - bright, underline and inverse
+ * - the others are only included for completeness
+ */
+
+var styleNums = {
+ reset : [0, 22]
+ , bright : [1, 22]
+ , dim : [2, 22]
+ , italic : [3, 23]
+ , underline : [4, 24]
+ , blink : [5, 25]
+ , inverse : [7, 27]
+ }
+ , styles = {}
+ ;
+
+Object.keys(styleNums).forEach(function (k) {
+ styles[k] = function (s) {
+ var open = styleNums[k][0]
+ , close = styleNums[k][1];
+ return '\u001b[' + open + 'm' + s + '\u001b[' + close + 'm';
+ };
+});
+
+module.exports = styles;
diff --git a/node_modules/ansistyles/package.json b/node_modules/ansistyles/package.json
new file mode 100644
index 00000000..2dad940a
--- /dev/null
+++ b/node_modules/ansistyles/package.json
@@ -0,0 +1,55 @@
+{
+ "_from": "ansistyles@0.1.3",
+ "_id": "ansistyles@0.1.3",
+ "_inBundle": false,
+ "_integrity": "sha1-XeYEFb2gcbs3EnhUyGT0GyMlRTk=",
+ "_location": "/ansistyles",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "ansistyles@0.1.3",
+ "name": "ansistyles",
+ "escapedName": "ansistyles",
+ "rawSpec": "0.1.3",
+ "saveSpec": null,
+ "fetchSpec": "0.1.3"
+ },
+ "_requiredBy": [
+ "/npm"
+ ],
+ "_resolved": "https://registry.npmjs.org/ansistyles/-/ansistyles-0.1.3.tgz",
+ "_shasum": "5de60415bda071bb37127854c864f41b23254539",
+ "_spec": "ansistyles@0.1.3",
+ "_where": "/Users/patrickglavin/Dev/fourth_hex/TSCasino/node_modules/npm",
+ "author": {
+ "name": "Thorsten Lorenz",
+ "email": "thlorenz@gmx.de",
+ "url": "thlorenz.com"
+ },
+ "bugs": {
+ "url": "https://github.com/thlorenz/ansistyles/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Functions that surround a string with ansistyle codes so it prints in style.",
+ "gitHead": "27bf1bc65231bcc7fd109bf13b13601b51f8cd04",
+ "homepage": "https://github.com/thlorenz/ansistyles#readme",
+ "keywords": [
+ "ansi",
+ "style",
+ "terminal",
+ "console"
+ ],
+ "license": "MIT",
+ "main": "ansistyles.js",
+ "name": "ansistyles",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/thlorenz/ansistyles.git"
+ },
+ "scripts": {
+ "test": "node test/ansistyles.js"
+ },
+ "version": "0.1.3"
+}
diff --git a/node_modules/ansistyles/test/ansistyles.js b/node_modules/ansistyles/test/ansistyles.js
new file mode 100644
index 00000000..f769bf80
--- /dev/null
+++ b/node_modules/ansistyles/test/ansistyles.js
@@ -0,0 +1,15 @@
+'use strict';
+/*jshint asi: true */
+var assert = require('assert')
+ , styles = require('../')
+
+function inspect(obj, depth) {
+ console.log(require('util').inspect(obj, false, depth || 5, true));
+}
+
+assert.equal(styles.reset('reset'), '\u001b[0mreset\u001b[22m', 'reset')
+assert.equal(styles.underline('underlined'), '\u001b[4munderlined\u001b[24m', 'underline')
+assert.equal(styles.bright('bright'), '\u001b[1mbright\u001b[22m', 'bright')
+assert.equal(styles.inverse('inversed'), '\u001b[7minversed\u001b[27m', 'inverse')
+
+console.log('OK');
diff --git a/node_modules/asap/CHANGES.md b/node_modules/asap/CHANGES.md
new file mode 100644
index 00000000..f105b919
--- /dev/null
+++ b/node_modules/asap/CHANGES.md
@@ -0,0 +1,70 @@
+
+## 2.0.6
+
+Version 2.0.4 adds support for React Native by clarifying in package.json that
+the browser environment does not support Node.js domains.
+Why this is necessary, we leave as an exercise for the user.
+
+## 2.0.3
+
+Version 2.0.3 fixes a bug when adjusting the capacity of the task queue.
+
+## 2.0.1-2.02
+
+Version 2.0.1 fixes a bug in the way redirects were expressed that affected the
+function of Browserify, but which Mr would tolerate.
+
+## 2.0.0
+
+Version 2 of ASAP is a full rewrite with a few salient changes.
+First, the ASAP source is CommonJS only and designed with [Browserify][] and
+[Browserify-compatible][Mr] module loaders in mind.
+
+[Browserify]: https://github.com/substack/node-browserify
+[Mr]: https://github.com/montagejs/mr
+
+The new version has been refactored in two dimensions.
+Support for Node.js and browsers have been separated, using Browserify
+redirects and ASAP has been divided into two modules.
+The "raw" layer depends on the tasks to catch thrown exceptions and unravel
+Node.js domains.
+
+The full implementation of ASAP is loadable as `require("asap")` in both Node.js
+and browsers.
+
+The raw layer that lacks exception handling overhead is loadable as
+`require("asap/raw")`.
+The interface is the same for both layers.
+
+Tasks are no longer required to be functions, but can rather be any object that
+implements `task.call()`.
+With this feature you can recycle task objects to avoid garbage collector churn
+and avoid closures in general.
+
+The implementation has been rigorously documented so that our successors can
+understand the scope of the problem that this module solves and all of its
+nuances, ensuring that the next generation of implementations know what details
+are essential.
+
+- [asap.js](https://github.com/kriskowal/asap/blob/master/asap.js)
+- [raw.js](https://github.com/kriskowal/asap/blob/master/raw.js)
+- [browser-asap.js](https://github.com/kriskowal/asap/blob/master/browser-asap.js)
+- [browser-raw.js](https://github.com/kriskowal/asap/blob/master/browser-raw.js)
+
+The new version has also been rigorously tested across a broad spectrum of
+browsers, in both the window and worker context.
+The following charts capture the browser test results for the most recent
+release.
+The first chart shows test results for ASAP running in the main window context.
+The second chart shows test results for ASAP running in a web worker context.
+Test results are inconclusive (grey) on browsers that do not support web
+workers.
+These data are captured automatically by [Continuous
+Integration][].
+
+
+
+
+
+[Continuous Integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md
+
diff --git a/node_modules/asap/LICENSE.md b/node_modules/asap/LICENSE.md
new file mode 100644
index 00000000..ba18c613
--- /dev/null
+++ b/node_modules/asap/LICENSE.md
@@ -0,0 +1,21 @@
+
+Copyright 2009–2014 Contributors. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
diff --git a/node_modules/asap/README.md b/node_modules/asap/README.md
new file mode 100644
index 00000000..452fd8c2
--- /dev/null
+++ b/node_modules/asap/README.md
@@ -0,0 +1,237 @@
+# ASAP
+
+[](https://travis-ci.org/kriskowal/asap)
+
+Promise and asynchronous observer libraries, as well as hand-rolled callback
+programs and libraries, often need a mechanism to postpone the execution of a
+callback until the next available event.
+(See [Designing API’s for Asynchrony][Zalgo].)
+The `asap` function executes a task **as soon as possible** but not before it
+returns, waiting only for the completion of the current event and previously
+scheduled tasks.
+
+```javascript
+asap(function () {
+ // ...
+});
+```
+
+[Zalgo]: http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony
+
+This CommonJS package provides an `asap` module that exports a function that
+executes a task function *as soon as possible*.
+
+ASAP strives to schedule events to occur before yielding for IO, reflow,
+or redrawing.
+Each event receives an independent stack, with only platform code in parent
+frames and the events run in the order they are scheduled.
+
+ASAP provides a fast event queue that will execute tasks until it is
+empty before yielding to the JavaScript engine's underlying event-loop.
+When a task gets added to a previously empty event queue, ASAP schedules a flush
+event, preferring for that event to occur before the JavaScript engine has an
+opportunity to perform IO tasks or rendering, thus making the first task and
+subsequent tasks semantically indistinguishable.
+ASAP uses a variety of techniques to preserve this invariant on different
+versions of browsers and Node.js.
+
+By design, ASAP prevents input events from being handled until the task
+queue is empty.
+If the process is busy enough, this may cause incoming connection requests to be
+dropped, and may cause existing connections to inform the sender to reduce the
+transmission rate or stall.
+ASAP allows this on the theory that, if there is enough work to do, there is no
+sense in looking for trouble.
+As a consequence, ASAP can interfere with smooth animation.
+If your task should be tied to the rendering loop, consider using
+`requestAnimationFrame` instead.
+A long sequence of tasks can also effect the long running script dialog.
+If this is a problem, you may be able to use ASAP’s cousin `setImmediate` to
+break long processes into shorter intervals and periodically allow the browser
+to breathe.
+`setImmediate` will yield for IO, reflow, and repaint events.
+It also returns a handler and can be canceled.
+For a `setImmediate` shim, consider [YuzuJS setImmediate][setImmediate].
+
+[setImmediate]: https://github.com/YuzuJS/setImmediate
+
+Take care.
+ASAP can sustain infinite recursive calls without warning.
+It will not halt from a stack overflow, and it will not consume unbounded
+memory.
+This is behaviorally equivalent to an infinite loop.
+Just as with infinite loops, you can monitor a Node.js process for this behavior
+with a heart-beat signal.
+As with infinite loops, a very small amount of caution goes a long way to
+avoiding problems.
+
+```javascript
+function loop() {
+ asap(loop);
+}
+loop();
+```
+
+In browsers, if a task throws an exception, it will not interrupt the flushing
+of high-priority tasks.
+The exception will be postponed to a later, low-priority event to avoid
+slow-downs.
+In Node.js, if a task throws an exception, ASAP will resume flushing only if—and
+only after—the error is handled by `domain.on("error")` or
+`process.on("uncaughtException")`.
+
+## Raw ASAP
+
+Checking for exceptions comes at a cost.
+The package also provides an `asap/raw` module that exports the underlying
+implementation which is faster but stalls if a task throws an exception.
+This internal version of the ASAP function does not check for errors.
+If a task does throw an error, it will stall the event queue unless you manually
+call `rawAsap.requestFlush()` before throwing the error, or any time after.
+
+In Node.js, `asap/raw` also runs all tasks outside any domain.
+If you need a task to be bound to your domain, you will have to do it manually.
+
+```js
+if (process.domain) {
+ task = process.domain.bind(task);
+}
+rawAsap(task);
+```
+
+## Tasks
+
+A task may be any object that implements `call()`.
+A function will suffice, but closures tend not to be reusable and can cause
+garbage collector churn.
+Both `asap` and `rawAsap` accept task objects to give you the option of
+recycling task objects or using higher callable object abstractions.
+See the `asap` source for an illustration.
+
+
+## Compatibility
+
+ASAP is tested on Node.js v0.10 and in a broad spectrum of web browsers.
+The following charts capture the browser test results for the most recent
+release.
+The first chart shows test results for ASAP running in the main window context.
+The second chart shows test results for ASAP running in a web worker context.
+Test results are inconclusive (grey) on browsers that do not support web
+workers.
+These data are captured automatically by [Continuous
+Integration][].
+
+[Continuous Integration]: https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md
+
+
+
+
+
+## Caveats
+
+When a task is added to an empty event queue, it is not always possible to
+guarantee that the task queue will begin flushing immediately after the current
+event.
+However, once the task queue begins flushing, it will not yield until the queue
+is empty, even if the queue grows while executing tasks.
+
+The following browsers allow the use of [DOM mutation observers][] to access
+the HTML [microtask queue][], and thus begin flushing ASAP's task queue
+immediately at the end of the current event loop turn, before any rendering or
+IO:
+
+[microtask queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#microtask-queue
+[DOM mutation observers]: http://dom.spec.whatwg.org/#mutation-observers
+
+- Android 4–4.3
+- Chrome 26–34
+- Firefox 14–29
+- Internet Explorer 11
+- iPad Safari 6–7.1
+- iPhone Safari 7–7.1
+- Safari 6–7
+
+In the absense of mutation observers, there are a few browsers, and situations
+like web workers in some of the above browsers, where [message channels][]
+would be a useful way to avoid falling back to timers.
+Message channels give direct access to the HTML [task queue][], so the ASAP
+task queue would flush after any already queued rendering and IO tasks, but
+without having the minimum delay imposed by timers.
+However, among these browsers, Internet Explorer 10 and Safari do not reliably
+dispatch messages, so they are not worth the trouble to implement.
+
+[message channels]: http://www.whatwg.org/specs/web-apps/current-work/multipage/web-messaging.html#message-channels
+[task queue]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#concept-task
+
+- Internet Explorer 10
+- Safair 5.0-1
+- Opera 11-12
+
+In the absense of mutation observers, these browsers and the following browsers
+all fall back to using `setTimeout` and `setInterval` to ensure that a `flush`
+occurs.
+The implementation uses both and cancels whatever handler loses the race, since
+`setTimeout` tends to occasionally skip tasks in unisolated circumstances.
+Timers generally delay the flushing of ASAP's task queue for four milliseconds.
+
+- Firefox 3–13
+- Internet Explorer 6–10
+- iPad Safari 4.3
+- Lynx 2.8.7
+
+
+## Heritage
+
+ASAP has been factored out of the [Q][] asynchronous promise library.
+It originally had a naïve implementation in terms of `setTimeout`, but
+[Malte Ubl][NonBlocking] provided an insight that `postMessage` might be
+useful for creating a high-priority, no-delay event dispatch hack.
+Since then, Internet Explorer proposed and implemented `setImmediate`.
+Robert Katić began contributing to Q by measuring the performance of
+the internal implementation of `asap`, paying particular attention to
+error recovery.
+Domenic, Robert, and Kris Kowal collectively settled on the current strategy of
+unrolling the high-priority event queue internally regardless of what strategy
+we used to dispatch the potentially lower-priority flush event.
+Domenic went on to make ASAP cooperate with Node.js domains.
+
+[Q]: https://github.com/kriskowal/q
+[NonBlocking]: http://www.nonblocking.io/2011/06/windownexttick.html
+
+For further reading, Nicholas Zakas provided a thorough article on [The
+Case for setImmediate][NCZ].
+
+[NCZ]: http://www.nczonline.net/blog/2013/07/09/the-case-for-setimmediate/
+
+Ember’s RSVP promise implementation later [adopted][RSVP ASAP] the name ASAP but
+further developed the implentation.
+Particularly, The `MessagePort` implementation was abandoned due to interaction
+[problems with Mobile Internet Explorer][IE Problems] in favor of an
+implementation backed on the newer and more reliable DOM `MutationObserver`
+interface.
+These changes were back-ported into this library.
+
+[IE Problems]: https://github.com/cujojs/when/issues/197
+[RSVP ASAP]: https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
+
+In addition, ASAP factored into `asap` and `asap/raw`, such that `asap` remained
+exception-safe, but `asap/raw` provided a tight kernel that could be used for
+tasks that guaranteed that they would not throw exceptions.
+This core is useful for promise implementations that capture thrown errors in
+rejected promises and do not need a second safety net.
+At the same time, the exception handling in `asap` was factored into separate
+implementations for Node.js and browsers, using the the [Browserify][Browser
+Config] `browser` property in `package.json` to instruct browser module loaders
+and bundlers, including [Browserify][], [Mr][], and [Mop][], to use the
+browser-only implementation.
+
+[Browser Config]: https://gist.github.com/defunctzombie/4339901
+[Browserify]: https://github.com/substack/node-browserify
+[Mr]: https://github.com/montagejs/mr
+[Mop]: https://github.com/montagejs/mop
+
+## License
+
+Copyright 2009-2014 by Contributors
+MIT License (enclosed)
+
diff --git a/node_modules/asap/asap.js b/node_modules/asap/asap.js
new file mode 100644
index 00000000..f04fcd58
--- /dev/null
+++ b/node_modules/asap/asap.js
@@ -0,0 +1,65 @@
+"use strict";
+
+var rawAsap = require("./raw");
+var freeTasks = [];
+
+/**
+ * Calls a task as soon as possible after returning, in its own event, with
+ * priority over IO events. An exception thrown in a task can be handled by
+ * `process.on("uncaughtException") or `domain.on("error")`, but will otherwise
+ * crash the process. If the error is handled, all subsequent tasks will
+ * resume.
+ *
+ * @param {{call}} task A callable object, typically a function that takes no
+ * arguments.
+ */
+module.exports = asap;
+function asap(task) {
+ var rawTask;
+ if (freeTasks.length) {
+ rawTask = freeTasks.pop();
+ } else {
+ rawTask = new RawTask();
+ }
+ rawTask.task = task;
+ rawTask.domain = process.domain;
+ rawAsap(rawTask);
+}
+
+function RawTask() {
+ this.task = null;
+ this.domain = null;
+}
+
+RawTask.prototype.call = function () {
+ if (this.domain) {
+ this.domain.enter();
+ }
+ var threw = true;
+ try {
+ this.task.call();
+ threw = false;
+ // If the task throws an exception (presumably) Node.js restores the
+ // domain stack for the next event.
+ if (this.domain) {
+ this.domain.exit();
+ }
+ } finally {
+ // We use try/finally and a threw flag to avoid messing up stack traces
+ // when we catch and release errors.
+ if (threw) {
+ // In Node.js, uncaught exceptions are considered fatal errors.
+ // Re-throw them to interrupt flushing!
+ // Ensure that flushing continues if an uncaught exception is
+ // suppressed listening process.on("uncaughtException") or
+ // domain.on("error").
+ rawAsap.requestFlush();
+ }
+ // If the task threw an error, we do not want to exit the domain here.
+ // Exiting the domain would prevent the domain from catching the error.
+ this.task = null;
+ this.domain = null;
+ freeTasks.push(this);
+ }
+};
+
diff --git a/node_modules/asap/browser-asap.js b/node_modules/asap/browser-asap.js
new file mode 100644
index 00000000..805c9824
--- /dev/null
+++ b/node_modules/asap/browser-asap.js
@@ -0,0 +1,66 @@
+"use strict";
+
+// rawAsap provides everything we need except exception management.
+var rawAsap = require("./raw");
+// RawTasks are recycled to reduce GC churn.
+var freeTasks = [];
+// We queue errors to ensure they are thrown in right order (FIFO).
+// Array-as-queue is good enough here, since we are just dealing with exceptions.
+var pendingErrors = [];
+var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
+
+function throwFirstError() {
+ if (pendingErrors.length) {
+ throw pendingErrors.shift();
+ }
+}
+
+/**
+ * Calls a task as soon as possible after returning, in its own event, with priority
+ * over other events like animation, reflow, and repaint. An error thrown from an
+ * event will not interrupt, nor even substantially slow down the processing of
+ * other events, but will be rather postponed to a lower priority event.
+ * @param {{call}} task A callable object, typically a function that takes no
+ * arguments.
+ */
+module.exports = asap;
+function asap(task) {
+ var rawTask;
+ if (freeTasks.length) {
+ rawTask = freeTasks.pop();
+ } else {
+ rawTask = new RawTask();
+ }
+ rawTask.task = task;
+ rawAsap(rawTask);
+}
+
+// We wrap tasks with recyclable task objects. A task object implements
+// `call`, just like a function.
+function RawTask() {
+ this.task = null;
+}
+
+// The sole purpose of wrapping the task is to catch the exception and recycle
+// the task object after its single use.
+RawTask.prototype.call = function () {
+ try {
+ this.task.call();
+ } catch (error) {
+ if (asap.onerror) {
+ // This hook exists purely for testing purposes.
+ // Its name will be periodically randomized to break any code that
+ // depends on its existence.
+ asap.onerror(error);
+ } else {
+ // In a web browser, exceptions are not fatal. However, to avoid
+ // slowing down the queue of pending tasks, we rethrow the error in a
+ // lower priority turn.
+ pendingErrors.push(error);
+ requestErrorThrow();
+ }
+ } finally {
+ this.task = null;
+ freeTasks[freeTasks.length] = this;
+ }
+};
diff --git a/node_modules/asap/browser-raw.js b/node_modules/asap/browser-raw.js
new file mode 100644
index 00000000..9cee7e32
--- /dev/null
+++ b/node_modules/asap/browser-raw.js
@@ -0,0 +1,223 @@
+"use strict";
+
+// Use the fastest means possible to execute a task in its own turn, with
+// priority over other events including IO, animation, reflow, and redraw
+// events in browsers.
+//
+// An exception thrown by a task will permanently interrupt the processing of
+// subsequent tasks. The higher level `asap` function ensures that if an
+// exception is thrown by a task, that the task queue will continue flushing as
+// soon as possible, but if you use `rawAsap` directly, you are responsible to
+// either ensure that no exceptions are thrown from your task, or to manually
+// call `rawAsap.requestFlush` if an exception is thrown.
+module.exports = rawAsap;
+function rawAsap(task) {
+ if (!queue.length) {
+ requestFlush();
+ flushing = true;
+ }
+ // Equivalent to push, but avoids a function call.
+ queue[queue.length] = task;
+}
+
+var queue = [];
+// Once a flush has been requested, no further calls to `requestFlush` are
+// necessary until the next `flush` completes.
+var flushing = false;
+// `requestFlush` is an implementation-specific method that attempts to kick
+// off a `flush` event as quickly as possible. `flush` will attempt to exhaust
+// the event queue before yielding to the browser's own event loop.
+var requestFlush;
+// The position of the next task to execute in the task queue. This is
+// preserved between calls to `flush` so that it can be resumed if
+// a task throws an exception.
+var index = 0;
+// If a task schedules additional tasks recursively, the task queue can grow
+// unbounded. To prevent memory exhaustion, the task queue will periodically
+// truncate already-completed tasks.
+var capacity = 1024;
+
+// The flush function processes all tasks that have been scheduled with
+// `rawAsap` unless and until one of those tasks throws an exception.
+// If a task throws an exception, `flush` ensures that its state will remain
+// consistent and will resume where it left off when called again.
+// However, `flush` does not make any arrangements to be called again if an
+// exception is thrown.
+function flush() {
+ while (index < queue.length) {
+ var currentIndex = index;
+ // Advance the index before calling the task. This ensures that we will
+ // begin flushing on the next task the task throws an error.
+ index = index + 1;
+ queue[currentIndex].call();
+ // Prevent leaking memory for long chains of recursive calls to `asap`.
+ // If we call `asap` within tasks scheduled by `asap`, the queue will
+ // grow, but to avoid an O(n) walk for every task we execute, we don't
+ // shift tasks off the queue after they have been executed.
+ // Instead, we periodically shift 1024 tasks off the queue.
+ if (index > capacity) {
+ // Manually shift all values starting at the index back to the
+ // beginning of the queue.
+ for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
+ queue[scan] = queue[scan + index];
+ }
+ queue.length -= index;
+ index = 0;
+ }
+ }
+ queue.length = 0;
+ index = 0;
+ flushing = false;
+}
+
+// `requestFlush` is implemented using a strategy based on data collected from
+// every available SauceLabs Selenium web driver worker at time of writing.
+// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
+
+// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
+// have WebKitMutationObserver but not un-prefixed MutationObserver.
+// Must use `global` or `self` instead of `window` to work in both frames and web
+// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
+
+/* globals self */
+var scope = typeof global !== "undefined" ? global : self;
+var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;
+
+// MutationObservers are desirable because they have high priority and work
+// reliably everywhere they are implemented.
+// They are implemented in all modern browsers.
+//
+// - Android 4-4.3
+// - Chrome 26-34
+// - Firefox 14-29
+// - Internet Explorer 11
+// - iPad Safari 6-7.1
+// - iPhone Safari 7-7.1
+// - Safari 6-7
+if (typeof BrowserMutationObserver === "function") {
+ requestFlush = makeRequestCallFromMutationObserver(flush);
+
+// MessageChannels are desirable because they give direct access to the HTML
+// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
+// 11-12, and in web workers in many engines.
+// Although message channels yield to any queued rendering and IO tasks, they
+// would be better than imposing the 4ms delay of timers.
+// However, they do not work reliably in Internet Explorer or Safari.
+
+// Internet Explorer 10 is the only browser that has setImmediate but does
+// not have MutationObservers.
+// Although setImmediate yields to the browser's renderer, it would be
+// preferrable to falling back to setTimeout since it does not have
+// the minimum 4ms penalty.
+// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
+// Desktop to a lesser extent) that renders both setImmediate and
+// MessageChannel useless for the purposes of ASAP.
+// https://github.com/kriskowal/q/issues/396
+
+// Timers are implemented universally.
+// We fall back to timers in workers in most engines, and in foreground
+// contexts in the following browsers.
+// However, note that even this simple case requires nuances to operate in a
+// broad spectrum of browsers.
+//
+// - Firefox 3-13
+// - Internet Explorer 6-9
+// - iPad Safari 4.3
+// - Lynx 2.8.7
+} else {
+ requestFlush = makeRequestCallFromTimer(flush);
+}
+
+// `requestFlush` requests that the high priority event queue be flushed as
+// soon as possible.
+// This is useful to prevent an error thrown in a task from stalling the event
+// queue if the exception handled by Node.js’s
+// `process.on("uncaughtException")` or by a domain.
+rawAsap.requestFlush = requestFlush;
+
+// To request a high priority event, we induce a mutation observer by toggling
+// the text of a text node between "1" and "-1".
+function makeRequestCallFromMutationObserver(callback) {
+ var toggle = 1;
+ var observer = new BrowserMutationObserver(callback);
+ var node = document.createTextNode("");
+ observer.observe(node, {characterData: true});
+ return function requestCall() {
+ toggle = -toggle;
+ node.data = toggle;
+ };
+}
+
+// The message channel technique was discovered by Malte Ubl and was the
+// original foundation for this library.
+// http://www.nonblocking.io/2011/06/windownexttick.html
+
+// Safari 6.0.5 (at least) intermittently fails to create message ports on a
+// page's first load. Thankfully, this version of Safari supports
+// MutationObservers, so we don't need to fall back in that case.
+
+// function makeRequestCallFromMessageChannel(callback) {
+// var channel = new MessageChannel();
+// channel.port1.onmessage = callback;
+// return function requestCall() {
+// channel.port2.postMessage(0);
+// };
+// }
+
+// For reasons explained above, we are also unable to use `setImmediate`
+// under any circumstances.
+// Even if we were, there is another bug in Internet Explorer 10.
+// It is not sufficient to assign `setImmediate` to `requestFlush` because
+// `setImmediate` must be called *by name* and therefore must be wrapped in a
+// closure.
+// Never forget.
+
+// function makeRequestCallFromSetImmediate(callback) {
+// return function requestCall() {
+// setImmediate(callback);
+// };
+// }
+
+// Safari 6.0 has a problem where timers will get lost while the user is
+// scrolling. This problem does not impact ASAP because Safari 6.0 supports
+// mutation observers, so that implementation is used instead.
+// However, if we ever elect to use timers in Safari, the prevalent work-around
+// is to add a scroll event listener that calls for a flush.
+
+// `setTimeout` does not call the passed callback if the delay is less than
+// approximately 7 in web workers in Firefox 8 through 18, and sometimes not
+// even then.
+
+function makeRequestCallFromTimer(callback) {
+ return function requestCall() {
+ // We dispatch a timeout with a specified delay of 0 for engines that
+ // can reliably accommodate that request. This will usually be snapped
+ // to a 4 milisecond delay, but once we're flushing, there's no delay
+ // between events.
+ var timeoutHandle = setTimeout(handleTimer, 0);
+ // However, since this timer gets frequently dropped in Firefox
+ // workers, we enlist an interval handle that will try to fire
+ // an event 20 times per second until it succeeds.
+ var intervalHandle = setInterval(handleTimer, 50);
+
+ function handleTimer() {
+ // Whichever timer succeeds will cancel both timers and
+ // execute the callback.
+ clearTimeout(timeoutHandle);
+ clearInterval(intervalHandle);
+ callback();
+ }
+ };
+}
+
+// This is for `asap.js` only.
+// Its name will be periodically randomized to break any code that depends on
+// its existence.
+rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
+
+// ASAP was originally a nextTick shim included in Q. This was factored out
+// into this ASAP package. It was later adapted to RSVP which made further
+// amendments. These decisions, particularly to marginalize MessageChannel and
+// to capture the MutationObserver implementation in a closure, were integrated
+// back into ASAP proper.
+// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
diff --git a/node_modules/asap/package.json b/node_modules/asap/package.json
new file mode 100644
index 00000000..dc902386
--- /dev/null
+++ b/node_modules/asap/package.json
@@ -0,0 +1,87 @@
+{
+ "_from": "asap@^2.0.0",
+ "_id": "asap@2.0.6",
+ "_inBundle": false,
+ "_integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=",
+ "_location": "/asap",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "asap@^2.0.0",
+ "name": "asap",
+ "escapedName": "asap",
+ "rawSpec": "^2.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^2.0.0"
+ },
+ "_requiredBy": [
+ "/dezalgo"
+ ],
+ "_resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
+ "_shasum": "e50347611d7e690943208bbdafebcbc2fb866d46",
+ "_spec": "asap@^2.0.0",
+ "_where": "/Users/patrickglavin/Dev/fourth_hex/TSCasino/node_modules/dezalgo",
+ "browser": {
+ "./asap": "./browser-asap.js",
+ "./asap.js": "./browser-asap.js",
+ "./raw": "./browser-raw.js",
+ "./raw.js": "./browser-raw.js",
+ "./test/domain.js": "./test/browser-domain.js"
+ },
+ "bugs": {
+ "url": "https://github.com/kriskowal/asap/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "High-priority task queue for Node.js and browsers",
+ "devDependencies": {
+ "benchmark": "^1.0.0",
+ "events": "^1.0.1",
+ "jshint": "^2.5.1",
+ "knox": "^0.8.10",
+ "mr": "^2.0.5",
+ "opener": "^1.3.0",
+ "q": "^2.0.3",
+ "q-io": "^2.0.3",
+ "saucelabs": "^0.1.1",
+ "wd": "^0.2.21",
+ "weak-map": "^1.0.5"
+ },
+ "files": [
+ "raw.js",
+ "asap.js",
+ "browser-raw.js",
+ "browser-asap.js"
+ ],
+ "homepage": "https://github.com/kriskowal/asap#readme",
+ "keywords": [
+ "event",
+ "task",
+ "queue"
+ ],
+ "license": "MIT",
+ "main": "./asap.js",
+ "name": "asap",
+ "react-native": {
+ "domain": false
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/kriskowal/asap.git"
+ },
+ "scripts": {
+ "benchmarks": "node benchmarks",
+ "lint": "jshint raw.js asap.js browser-raw.js browser-asap.js $(find scripts -name '*.js' | grep -v gauntlet)",
+ "test": "npm run lint && npm run test-node",
+ "test-browser": "node scripts/publish-bundle.js test/asap-test.js | xargs opener",
+ "test-node": "node test/asap-test.js",
+ "test-publish": "node scripts/publish-bundle.js test/asap-test.js | pbcopy",
+ "test-saucelabs": "node scripts/saucelabs.js test/asap-test.js scripts/saucelabs-spot-configurations.json",
+ "test-saucelabs-all": "node scripts/saucelabs.js test/asap-test.js scripts/saucelabs-all-configurations.json",
+ "test-saucelabs-worker": "node scripts/saucelabs-worker-test.js scripts/saucelabs-spot-configurations.json",
+ "test-saucelabs-worker-all": "node scripts/saucelabs-worker-test.js scripts/saucelabs-all-configurations.json",
+ "test-travis": "npm run lint && npm run test-node && npm run test-saucelabs && npm run test-saucelabs-worker"
+ },
+ "version": "2.0.6"
+}
diff --git a/node_modules/asap/raw.js b/node_modules/asap/raw.js
new file mode 100644
index 00000000..ae3b8923
--- /dev/null
+++ b/node_modules/asap/raw.js
@@ -0,0 +1,101 @@
+"use strict";
+
+var domain; // The domain module is executed on demand
+var hasSetImmediate = typeof setImmediate === "function";
+
+// Use the fastest means possible to execute a task in its own turn, with
+// priority over other events including network IO events in Node.js.
+//
+// An exception thrown by a task will permanently interrupt the processing of
+// subsequent tasks. The higher level `asap` function ensures that if an
+// exception is thrown by a task, that the task queue will continue flushing as
+// soon as possible, but if you use `rawAsap` directly, you are responsible to
+// either ensure that no exceptions are thrown from your task, or to manually
+// call `rawAsap.requestFlush` if an exception is thrown.
+module.exports = rawAsap;
+function rawAsap(task) {
+ if (!queue.length) {
+ requestFlush();
+ flushing = true;
+ }
+ // Avoids a function call
+ queue[queue.length] = task;
+}
+
+var queue = [];
+// Once a flush has been requested, no further calls to `requestFlush` are
+// necessary until the next `flush` completes.
+var flushing = false;
+// The position of the next task to execute in the task queue. This is
+// preserved between calls to `flush` so that it can be resumed if
+// a task throws an exception.
+var index = 0;
+// If a task schedules additional tasks recursively, the task queue can grow
+// unbounded. To prevent memory excaustion, the task queue will periodically
+// truncate already-completed tasks.
+var capacity = 1024;
+
+// The flush function processes all tasks that have been scheduled with
+// `rawAsap` unless and until one of those tasks throws an exception.
+// If a task throws an exception, `flush` ensures that its state will remain
+// consistent and will resume where it left off when called again.
+// However, `flush` does not make any arrangements to be called again if an
+// exception is thrown.
+function flush() {
+ while (index < queue.length) {
+ var currentIndex = index;
+ // Advance the index before calling the task. This ensures that we will
+ // begin flushing on the next task the task throws an error.
+ index = index + 1;
+ queue[currentIndex].call();
+ // Prevent leaking memory for long chains of recursive calls to `asap`.
+ // If we call `asap` within tasks scheduled by `asap`, the queue will
+ // grow, but to avoid an O(n) walk for every task we execute, we don't
+ // shift tasks off the queue after they have been executed.
+ // Instead, we periodically shift 1024 tasks off the queue.
+ if (index > capacity) {
+ // Manually shift all values starting at the index back to the
+ // beginning of the queue.
+ for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
+ queue[scan] = queue[scan + index];
+ }
+ queue.length -= index;
+ index = 0;
+ }
+ }
+ queue.length = 0;
+ index = 0;
+ flushing = false;
+}
+
+rawAsap.requestFlush = requestFlush;
+function requestFlush() {
+ // Ensure flushing is not bound to any domain.
+ // It is not sufficient to exit the domain, because domains exist on a stack.
+ // To execute code outside of any domain, the following dance is necessary.
+ var parentDomain = process.domain;
+ if (parentDomain) {
+ if (!domain) {
+ // Lazy execute the domain module.
+ // Only employed if the user elects to use domains.
+ domain = require("domain");
+ }
+ domain.active = process.domain = null;
+ }
+
+ // `setImmediate` is slower that `process.nextTick`, but `process.nextTick`
+ // cannot handle recursion.
+ // `requestFlush` will only be called recursively from `asap.js`, to resume
+ // flushing after an error is thrown into a domain.
+ // Conveniently, `setImmediate` was introduced in the same version
+ // `process.nextTick` started throwing recursion errors.
+ if (flushing && hasSetImmediate) {
+ setImmediate(flush);
+ } else {
+ process.nextTick(flush);
+ }
+
+ if (parentDomain) {
+ domain.active = process.domain = parentDomain;
+ }
+}
diff --git a/node_modules/async-some/.eslintrc b/node_modules/async-some/.eslintrc
new file mode 100644
index 00000000..5c39c67e
--- /dev/null
+++ b/node_modules/async-some/.eslintrc
@@ -0,0 +1,18 @@
+{
+ "env" : {
+ "node" : true
+ },
+ "rules" : {
+ "curly" : 0,
+ "no-lonely-if" : 1,
+ "no-mixed-requires" : 0,
+ "no-underscore-dangle" : 0,
+ "no-unused-vars" : [2, {"vars" : "all", "args" : "after-used"}],
+ "no-use-before-define" : [2, "nofunc"],
+ "quotes" : [1, "double", "avoid-escape"],
+ "semi" : [2, "never"],
+ "space-after-keywords" : 1,
+ "space-infix-ops" : 0,
+ "strict" : 0
+ }
+}
diff --git a/node_modules/async-some/.npmignore b/node_modules/async-some/.npmignore
new file mode 100644
index 00000000..3c3629e6
--- /dev/null
+++ b/node_modules/async-some/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/async-some/LICENSE b/node_modules/async-some/LICENSE
new file mode 100644
index 00000000..d21147bf
--- /dev/null
+++ b/node_modules/async-some/LICENSE
@@ -0,0 +1,13 @@
+Copyright (c) 2014-2015, Forrest L Norvell
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/async-some/README.md b/node_modules/async-some/README.md
new file mode 100644
index 00000000..bb502ee0
--- /dev/null
+++ b/node_modules/async-some/README.md
@@ -0,0 +1,62 @@
+# some
+
+Short-circuited async Array.prototype.some implementation.
+
+Serially evaluates a list of values from a JS array or arraylike
+against an asynchronous predicate, terminating on the first truthy
+value. If the predicate encounters an error, pass it to the completion
+callback. Otherwise, pass the truthy value passed by the predicate, or
+`false` if no truthy value was passed.
+
+Is
+[Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)-proof,
+browser-safe, and pretty efficient.
+
+## Usage
+
+```javascript
+var some = require("async-some");
+var resolve = require("path").resolve;
+var stat = require("fs").stat;
+var readFileSync = require("fs").readFileSync;
+
+some(["apple", "seaweed", "ham", "quince"], porkDetector, function (error, match) {
+ if (error) return console.error(error);
+
+ if (match) return console.dir(JSON.parse(readFileSync(match)));
+
+ console.error("time to buy more Sporkle™!");
+});
+
+var PREFIX = resolve(__dirname, "../pork_store");
+function porkDetector(value, cb) {
+ var path = resolve(PREFIX, value + ".json");
+ stat(path, function (er, stat) {
+ if (er) {
+ if (er.code === "ENOENT") return cb(null, false);
+
+ return cb(er);
+ }
+
+ cb(er, path);
+ });
+}
+```
+
+### some(list, test, callback)
+
+* `list` {Object} An arraylike (either an Array or the arguments arraylike) to
+ be checked.
+* `test` {Function} The predicate against which the elements of `list` will be
+ tested. Takes two parameters:
+ * `element` {any} The element of the list to be tested.
+ * `callback` {Function} The continuation to be called once the test is
+ complete. Takes (again) two values:
+ * `error` {Error} Any errors that the predicate encountered.
+ * `value` {any} A truthy value. A non-falsy result terminates checking the
+ entire list.
+* `callback` {Function} The callback to invoke when either a value has been
+ found or the entire input list has been processed with no result. Is invoked
+ with the traditional two parameters:
+ * `error` {Error} Errors that were encountered during the evaluation of some().
+ * `match` {any} Value successfully matched by `test`, if any.
diff --git a/node_modules/async-some/package.json b/node_modules/async-some/package.json
new file mode 100644
index 00000000..183e9dee
--- /dev/null
+++ b/node_modules/async-some/package.json
@@ -0,0 +1,60 @@
+{
+ "_from": "async-some@1.0.2",
+ "_id": "async-some@1.0.2",
+ "_inBundle": false,
+ "_integrity": "sha1-TYqBYg1ZWHkbW5j4AtMgd3bpVQk=",
+ "_location": "/async-some",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "async-some@1.0.2",
+ "name": "async-some",
+ "escapedName": "async-some",
+ "rawSpec": "1.0.2",
+ "saveSpec": null,
+ "fetchSpec": "1.0.2"
+ },
+ "_requiredBy": [
+ "/npm"
+ ],
+ "_resolved": "https://registry.npmjs.org/async-some/-/async-some-1.0.2.tgz",
+ "_shasum": "4d8a81620d5958791b5b98f802d3207776e95509",
+ "_spec": "async-some@1.0.2",
+ "_where": "/Users/patrickglavin/Dev/fourth_hex/TSCasino/node_modules/npm",
+ "author": {
+ "name": "Forrest L Norvell",
+ "email": "ogd@aoaioxxysz.net"
+ },
+ "bugs": {
+ "url": "https://github.com/othiym23/async-some/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "dezalgo": "^1.0.2"
+ },
+ "deprecated": false,
+ "description": "short-circuited, asynchronous version of Array.protototype.some",
+ "devDependencies": {
+ "tap": "^1.1.0"
+ },
+ "homepage": "https://github.com/othiym23/async-some",
+ "keywords": [
+ "async",
+ "some",
+ "array",
+ "collections",
+ "fp"
+ ],
+ "license": "ISC",
+ "main": "some.js",
+ "name": "async-some",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/othiym23/async-some.git"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "version": "1.0.2"
+}
diff --git a/node_modules/async-some/some.js b/node_modules/async-some/some.js
new file mode 100644
index 00000000..0419709f
--- /dev/null
+++ b/node_modules/async-some/some.js
@@ -0,0 +1,47 @@
+var assert = require("assert")
+var dezalgoify = require("dezalgo")
+
+module.exports = some
+
+/**
+ * short-circuited async Array.prototype.some implementation
+ *
+ * Serially evaluates a list of values from a JS array or arraylike
+ * against an asynchronous predicate, terminating on the first truthy
+ * value. If the predicate encounters an error, pass it to the completion
+ * callback. Otherwise, pass the truthy value passed by the predicate, or
+ * `false` if no truthy value was passed.
+ */
+function some (list, test, cb) {
+ assert("length" in list, "array must be arraylike")
+ assert.equal(typeof test, "function", "predicate must be callable")
+ assert.equal(typeof cb, "function", "callback must be callable")
+
+ var array = slice(list)
+ , index = 0
+ , length = array.length
+ , hecomes = dezalgoify(cb)
+
+ map()
+
+ function map () {
+ if (index >= length) return hecomes(null, false)
+
+ test(array[index], reduce)
+ }
+
+ function reduce (er, result) {
+ if (er) return hecomes(er, false)
+ if (result) return hecomes(null, result)
+
+ index++
+ map()
+ }
+}
+
+// Array.prototype.slice on arguments arraylike is expensive
+function slice(args) {
+ var l = args.length, a = [], i
+ for (i = 0; i < l; i++) a[i] = args[i]
+ return a
+}
diff --git a/node_modules/async-some/test/base-case.js b/node_modules/async-some/test/base-case.js
new file mode 100644
index 00000000..35689052
--- /dev/null
+++ b/node_modules/async-some/test/base-case.js
@@ -0,0 +1,35 @@
+var test = require("tap").test
+
+var some = require("../some.js")
+
+test("some() array base case", function (t) {
+ some([], failer, function (error, match) {
+ t.ifError(error, "ran successfully")
+
+ t.notOk(match, "nothing to find, so nothing found")
+
+ t.end()
+ })
+
+ function failer(value, cb) {
+ cb(new Error("test should never have been called"))
+ }
+})
+
+test("some() arguments arraylike base case", function (t) {
+ go()
+
+ function go() {
+ some(arguments, failer, function (error, match) {
+ t.ifError(error, "ran successfully")
+
+ t.notOk(match, "nothing to find, so nothing found")
+
+ t.end()
+ })
+
+ function failer(value, cb) {
+ cb(new Error("test should never have been called"))
+ }
+ }
+})
diff --git a/node_modules/async-some/test/parameters.js b/node_modules/async-some/test/parameters.js
new file mode 100644
index 00000000..0706d1da
--- /dev/null
+++ b/node_modules/async-some/test/parameters.js
@@ -0,0 +1,37 @@
+var test = require("tap").test
+
+var some = require("../some.js")
+
+var NOP = function () {}
+
+test("some() called with bogus parameters", function (t) {
+ t.throws(function () {
+ some()
+ }, "throws when called with no parameters")
+
+ t.throws(function () {
+ some(null, NOP, NOP)
+ }, "throws when called with no list")
+
+ t.throws(function () {
+ some([], null, NOP)
+ }, "throws when called with no predicate")
+
+ t.throws(function () {
+ some([], NOP, null)
+ }, "throws when called with no callback")
+
+ t.throws(function () {
+ some({}, NOP, NOP)
+ }, "throws when called with wrong list type")
+
+ t.throws(function () {
+ some([], "ham", NOP)
+ }, "throws when called with wrong test type")
+
+ t.throws(function () {
+ some([], NOP, "ham")
+ }, "throws when called with wrong test type")
+
+ t.end()
+})
diff --git a/node_modules/async-some/test/simple.js b/node_modules/async-some/test/simple.js
new file mode 100644
index 00000000..3d68e1e5
--- /dev/null
+++ b/node_modules/async-some/test/simple.js
@@ -0,0 +1,60 @@
+var test = require("tap").test
+
+var some = require("../some.js")
+
+test("some() doesn't find anything asynchronously", function (t) {
+ some(["a", "b", "c", "d", "e", "f", "g"], predicate, function (error, match) {
+ t.ifError(error, "ran successfully")
+
+ t.notOk(match, "nothing to find, so nothing found")
+
+ t.end()
+ })
+
+ function predicate(value, cb) {
+ // dezalgo ensures it's safe to not do this, but just in case
+ setTimeout(function () { cb(null, value > "j" && value) })
+ }
+})
+
+test("some() doesn't find anything synchronously", function (t) {
+ some(["a", "b", "c", "d", "e", "f", "g"], predicate, function (error, match) {
+ t.ifError(error, "ran successfully")
+
+ t.notOk(match, "nothing to find, so nothing found")
+
+ t.end()
+ })
+
+ function predicate(value, cb) {
+ cb(null, value > "j" && value)
+ }
+})
+
+test("some() doesn't find anything asynchronously", function (t) {
+ some(["a", "b", "c", "d", "e", "f", "g"], predicate, function (error, match) {
+ t.ifError(error, "ran successfully")
+
+ t.equals(match, "d", "found expected element")
+
+ t.end()
+ })
+
+ function predicate(value, cb) {
+ setTimeout(function () { cb(null, value > "c" && value) })
+ }
+})
+
+test("some() doesn't find anything synchronously", function (t) {
+ some(["a", "b", "c", "d", "e", "f", "g"], predicate, function (error, match) {
+ t.ifError(error, "ran successfully")
+
+ t.equals(match, "d", "found expected")
+
+ t.end()
+ })
+
+ function predicate(value, cb) {
+ cb(null, value > "c" && value)
+ }
+})
diff --git a/node_modules/balanced-match/.npmignore b/node_modules/balanced-match/.npmignore
new file mode 100644
index 00000000..ae5d8c36
--- /dev/null
+++ b/node_modules/balanced-match/.npmignore
@@ -0,0 +1,5 @@
+test
+.gitignore
+.travis.yml
+Makefile
+example.js
diff --git a/node_modules/balanced-match/LICENSE.md b/node_modules/balanced-match/LICENSE.md
new file mode 100644
index 00000000..2cdc8e41
--- /dev/null
+++ b/node_modules/balanced-match/LICENSE.md
@@ -0,0 +1,21 @@
+(MIT)
+
+Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/balanced-match/README.md b/node_modules/balanced-match/README.md
new file mode 100644
index 00000000..08e918c0
--- /dev/null
+++ b/node_modules/balanced-match/README.md
@@ -0,0 +1,91 @@
+# balanced-match
+
+Match balanced string pairs, like `{` and `}` or `