Skip to content

Commit

Permalink
Add polyfill to structuredClone and set target node to 13.x
Browse files Browse the repository at this point in the history
  • Loading branch information
prajwalkulkarni committed Jan 11, 2024
1 parent a13043a commit 80ece5e
Show file tree
Hide file tree
Showing 6 changed files with 2,006 additions and 294 deletions.
7 changes: 7 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"presets": [["@babel/preset-env", { "targets": { "node": "13.2.0" },
"useBuiltIns":"usage",
"modules": false,
"corejs": "3.35.0"
}] ]
}
481 changes: 471 additions & 10 deletions bin.js

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env node
import { readLine, commonCards, chips } from "./constants.js";

const map = new Map();

let splitSecondHand;
Expand Down Expand Up @@ -113,9 +112,9 @@ class Game extends Card {
readLine.question(
`${betOptions.map(
(bet, index) => index + 1 + ". $" + bet
)}\n[Press 1 to select $${betOptions[0]}, 2 to select $${
betOptions[1]
}, 3 to select $${betOptions[2]}]\n`,
)}\n[Press 1 to select $${betOptions[0]}, 2 to select $${betOptions[1]} ${
betOptions[2] ? ", 3 to select $" + betOptions[2] : ""
}]\n`,
(input) => {
switch (+input) {
case 1:
Expand All @@ -129,10 +128,16 @@ class Game extends Card {
this.#serveInitialCards();
break;
case 3:
this.stake = betOptions[2];
this.cash -= this.stake;
this.#serveInitialCards();
break;
if (this.#getBalance() <= 500) {
console.log("Invalid input entered, please try again");
this.startGame();
return;
} else {
this.stake = betOptions[2];
this.cash -= this.stake;
this.#serveInitialCards();
break;
}
default:
console.log("Invalid input entered, please try again");
this.startGame();
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blackjack21",
"version": "1.0.5",
"version": "1.0.6",
"description": "Blackjack on command line",
"type": "module",
"scripts": {
Expand All @@ -24,11 +24,17 @@
"url": "https://github.com/prajwalkulkarni/cli-blackjack/issues"
},
"homepage": "https://github.com/prajwalkulkarni/cli-blackjack#readme",
"bin": "./bin.cjs",
"bin": "./bin.js",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"vite": "^5.0.11"
"@babel/cli": "^7.23.4",
"@babel/core": "^7.23.7",
"@babel/preset-env": "^7.23.8"
},
"dependencies": {
"@babel/polyfill": "^7.12.1",
"core-js": "^3.35.0"
}
}
16 changes: 0 additions & 16 deletions vite.config.js

This file was deleted.

Loading

0 comments on commit 80ece5e

Please sign in to comment.