-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
62 lines (55 loc) · 1.35 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
import wordList from "./words.json" assert { type: "json" };
class Roastra {
constructor(options) {
if (options.plural === true) {
this.plural = "are";
} else {
this.plural = "is";
}
if (options.name === false || options.name === undefined) {
this.name = "You";
this.plural = "are";
} else {
this.name = options.name;
}
if (this.name.toLowerCase() === "they") {
this.plural = "are";
}
this.options = options;
}
Get(callback) {
var t = {
adjective: [
wordList.adjective[
Math.floor(Math.random() * wordList.adjective.length)
],
wordList.adjective[
Math.floor(Math.random() * wordList.adjective.length)
],
wordList.adjective[
Math.floor(Math.random() * wordList.adjective.length)
],
],
amount: wordList.amount[
Math.floor(Math.random() * wordList.amount.length)
],
animal: wordList.animal[
Math.floor(Math.random() * wordList.animal.length)
],
animal_part:
wordList.animal_part[
Math.floor(Math.random() * wordList.animal_part.length)
],
};
var sentance = `${this.name} ${this.plural} ${t.adjective[0]} as a ${t.adjective[1]} ${t.amount} of ${t.adjective[2]} ${t.animal} ${t.animal_part}`;
var result = {
sentance,
name: this.name,
};
if (typeof callback === "function") {
callback(result);
}
return result;
}
}
export default Roastra;