-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
65 lines (56 loc) · 1.66 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const { gtBets } = require("./gtBets");
const { bovada } = require("./bovada");
const { bookMaker } = require("./bookMaker");
const { fanDuel } = require("./fanDuel");
const dist = require("./dist.json");
const distB = require("./distB.json");
const distC = require("./distC.json");
const distD = require("./distD.json");
const readline = require("readline");
async function gatherAll() {
await gtBets();
await bovada();
await bookMaker();
await fanDuel();
}
async function findBestLine() {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
process.stdout.write(
"Enter city of NBA team, playing either today or tomorrow, don't forget spaces :) \n"
);
rl.on("line", async (input) => {
const P = ["LOADING\\", "LOADING|", "LOADING/", "LOADING-"];
var x = 0;
const interval = setInterval(function () {
process.stdout.write("\r" + P[x++]);
x &= 3;
}, 250);
await gatherAll().then((res) => console.log(res));
const teamRegex = new RegExp(input, "i");
const matchingGameObjectsDist = dist.filter((obj) =>
teamRegex.test(obj.teams)
);
const matchingGameObjectsDistB = distB.filter((obj) =>
teamRegex.test(obj.teams)
);
const matchingGameObjectsDistC = distC.filter((obj) =>
teamRegex.test(obj.teams)
);
const matchingGameObjectsDistD = distD.filter((obj) =>
teamRegex.test(obj.teams)
);
console.log(
matchingGameObjectsDist,
matchingGameObjectsDistB,
matchingGameObjectsDistC,
matchingGameObjectsDistD
);
clearInterval(interval);
rl.close();
});
}
findBestLine();
///findBestLine("Dallas");