@elara-services/packages 5.3.1 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/package.json +44 -0
  2. package/dist/src/index.d.ts +1 -0
  3. package/dist/src/index.js +17 -0
  4. package/dist/src/interfaces/discord.d.ts +91 -0
  5. package/dist/src/interfaces/discord.js +2 -0
  6. package/dist/src/interfaces/index.d.ts +1 -0
  7. package/dist/src/interfaces/index.js +17 -0
  8. package/dist/src/lib/AES.d.ts +7 -0
  9. package/dist/src/lib/AES.js +82 -0
  10. package/dist/src/lib/discord.d.ts +136 -0
  11. package/dist/src/lib/discord.js +381 -0
  12. package/dist/src/lib/index.d.ts +8 -0
  13. package/dist/src/lib/index.js +24 -0
  14. package/dist/src/lib/languages.d.ts +220 -0
  15. package/dist/src/lib/languages.js +125 -0
  16. package/dist/src/lib/minesweeper.d.ts +20 -0
  17. package/dist/src/lib/minesweeper.js +81 -0
  18. package/dist/src/lib/misc.d.ts +1 -0
  19. package/dist/src/lib/misc.js +73 -0
  20. package/dist/src/lib/random.d.ts +16 -0
  21. package/dist/src/lib/random.js +2035 -0
  22. package/dist/src/lib/tasks.d.ts +9 -0
  23. package/dist/src/lib/tasks.js +72 -0
  24. package/docs/.nojekyll +1 -0
  25. package/docs/assets/highlight.css +22 -0
  26. package/docs/assets/main.js +58 -0
  27. package/docs/assets/search.js +1 -0
  28. package/docs/assets/style.css +1367 -0
  29. package/docs/classes/AES.html +144 -0
  30. package/docs/classes/Minesweeper.html +205 -0
  31. package/docs/classes/Tasks.html +141 -0
  32. package/docs/functions/fetch.html +89 -0
  33. package/docs/functions/randomWeight.html +79 -0
  34. package/docs/functions/randomWords.html +74 -0
  35. package/docs/index.html +163 -0
  36. package/docs/interfaces/ButtonOptions.html +154 -0
  37. package/docs/interfaces/ModalOptions.html +124 -0
  38. package/docs/interfaces/RandomWord.html +153 -0
  39. package/docs/interfaces/SelectOptions.html +159 -0
  40. package/docs/interfaces/Slash.html +138 -0
  41. package/docs/interfaces/SlashOptions.html +187 -0
  42. package/docs/interfaces/TaskCreate.html +103 -0
  43. package/docs/interfaces/TextInputOptions.html +180 -0
  44. package/docs/modules.html +101 -0
  45. package/docs/types/ButtonNumberStyles.html +65 -0
  46. package/docs/types/ButtonStyles.html +65 -0
  47. package/docs/types/ChannelTypes.html +65 -0
  48. package/docs/types/Lang.html +65 -0
  49. package/docs/types/LangName.html +65 -0
  50. package/docs/variables/ButtonStyle.html +88 -0
  51. package/docs/variables/Duration.html +109 -0
  52. package/docs/variables/Interactions.html +159 -0
  53. package/docs/variables/Languages.html +294 -0
  54. package/docs/variables/SlashBuilder.html +238 -0
  55. package/package.json +44 -10
  56. package/.github/renovate.json +0 -5
  57. package/CHANGELOG +0 -62
  58. package/index.d.ts +0 -247
  59. package/index.js +0 -11
  60. package/packages/Interactions.js +0 -76
  61. package/packages/SlashBuilder.js +0 -58
  62. package/packages/Tasks.js +0 -22
  63. package/packages/aes256.js +0 -62
  64. package/packages/duration.js +0 -74
  65. package/packages/fetch.js +0 -30
  66. package/packages/languages.js +0 -119
  67. package/packages/minesweeper.js +0 -77
  68. package/packages/random/weight.js +0 -8
  69. package/packages/random/words.js +0 -300
@@ -1,119 +0,0 @@
1
- const langs = {
2
- 'en': 'English',
3
- 'fr': 'French',
4
- 'es': 'Spanish',
5
- 'pt': 'Portuguese',
6
- 'tr': 'Turkish',
7
- 'ru': 'Russian',
8
- 'ar': 'Arabic',
9
-
10
- 'af': 'Afrikaans',
11
- 'sq': 'Albanian',
12
- 'am': 'Amharic',
13
- 'hy': 'Armenian',
14
- 'az': 'Azerbaijani',
15
- 'eu': 'Basque',
16
- 'be': 'Belarusian',
17
- 'bn': 'Bengali',
18
- 'bs': 'Bosnian',
19
- 'bg': 'Bulgarian',
20
- 'ca': 'Catalan',
21
- 'ceb': 'Cebuano',
22
- 'ny': 'Chichewa',
23
- 'zh': 'Chinese (Simplified)',
24
- 'zh-tw': 'Chinese (Traditional)',
25
- 'co': 'Corsican',
26
- 'hr': 'Croatian',
27
- 'cs': 'Czech',
28
- 'da': 'Danish',
29
- 'nl': 'Dutch',
30
- 'eo': 'Esperanto',
31
- 'et': 'Estonian',
32
- 'tl': 'Filipino',
33
- 'fi': 'Finnish',
34
- 'fy': 'Frisian',
35
- 'gl': 'Galician',
36
- 'ka': 'Georgian',
37
- 'de': 'German',
38
- 'el': 'Greek',
39
- 'gu': 'Gujarati',
40
- 'ht': 'Haitian Creole',
41
- 'ha': 'Hausa',
42
- 'haw': 'Hawaiian',
43
- 'he': 'Hebrew',
44
- 'iw': 'Hebrew',
45
- 'hi': 'Hindi',
46
- 'hmn': 'Hmong',
47
- 'hu': 'Hungarian',
48
- 'is': 'Icelandic',
49
- 'ig': 'Igbo',
50
- 'id': 'Indonesian',
51
- 'ga': 'Irish',
52
- 'it': 'Italian',
53
- 'ja': 'Japanese',
54
- 'jw': 'Javanese',
55
- 'kn': 'Kannada',
56
- 'kk': 'Kazakh',
57
- 'km': 'Khmer',
58
- 'ko': 'Korean',
59
- 'ku': 'Kurdish (Kurmanji)',
60
- 'ky': 'Kyrgyz',
61
- 'lo': 'Lao',
62
- 'la': 'Latin',
63
- 'lv': 'Latvian',
64
- 'lt': 'Lithuanian',
65
- 'lb': 'Luxembourgish',
66
- 'mk': 'Macedonian',
67
- 'mg': 'Malagasy',
68
- 'ms': 'Malay',
69
- 'ml': 'Malayalam',
70
- 'mt': 'Maltese',
71
- 'mi': 'Maori',
72
- 'mr': 'Marathi',
73
- 'mn': 'Mongolian',
74
- 'my': 'Myanmar (Burmese)',
75
- 'ne': 'Nepali',
76
- 'no': 'Norwegian',
77
- 'ps': 'Pashto',
78
- 'fa': 'Persian',
79
- 'pl': 'Polish',
80
- 'pa': 'Punjabi',
81
- 'ro': 'Romanian',
82
- 'sm': 'Samoan',
83
- 'gd': 'Scots Gaelic',
84
- 'sr': 'Serbian',
85
- 'st': 'Sesotho',
86
- 'sn': 'Shona',
87
- 'sd': 'Sindhi',
88
- 'si': 'Sinhala',
89
- 'sk': 'Slovak',
90
- 'sl': 'Slovenian',
91
- 'so': 'Somali',
92
- 'su': 'Sundanese',
93
- 'sw': 'Swahili',
94
- 'sv': 'Swedish',
95
- 'tg': 'Tajik',
96
- 'ta': 'Tamil',
97
- 'te': 'Telugu',
98
- 'th': 'Thai',
99
- 'uk': 'Ukrainian',
100
- 'ur': 'Urdu',
101
- 'uz': 'Uzbek',
102
- 'vi': 'Vietnamese',
103
- 'cy': 'Welsh',
104
- 'xh': 'Xhosa',
105
- 'yi': 'Yiddish',
106
- 'yo': 'Yoruba',
107
- 'zu': 'Zulu'
108
- };
109
- /** @deprecated */
110
- module.exports = langs;
111
- module.exports.langs = langs;
112
-
113
- module.exports.find = (name) => {
114
- for (const key of Object.keys(langs)) {
115
- if (key === name) return key;
116
- if (langs[key] === name) return key;
117
- }
118
- return null;
119
- }
@@ -1,77 +0,0 @@
1
- module.exports = class Minesweeper {
2
- /**
3
- * The constructor of the Minesweeper class.
4
- * @constructor
5
- * @param {MinesweeperOpts} opts - The options of the Minesweeper class.
6
- */
7
- constructor(opts) {
8
- this.rows = opts?.rows ?? 5;
9
- this.columns = opts?.columns ?? 5;
10
- this.mines = opts?.mines ?? 5;
11
- this.matrix = [];
12
- this.types = {
13
- mine: opts?.emote ?? "bomb",
14
- numbers: [
15
- 'zero', 'one', 'two',
16
- 'three', 'four', 'five',
17
- 'six', 'seven', 'eight'
18
- ]
19
- };
20
- }
21
-
22
- /**
23
- * Fills the matrix with "zero" emojis.
24
- */
25
- generateEmptyMatrix() {
26
- for (let i = 0; i < this.rows; i++) {
27
- const arr = new Array(this.columns).fill(this.types.numbers[0]);
28
- this.matrix.push(arr);
29
- }
30
- }
31
- /**
32
- * Plants mines in the matrix randomly.
33
- */
34
- plantMines() {
35
- for (let i = 0; i < this.mines; i++) {
36
- const x = Math.floor(Math.random() * this.rows);
37
- const y = Math.floor(Math.random() * this.columns);
38
- if (this.matrix[x][y] === this.types.mine) i--;
39
- else this.matrix[x][y] = this.types.mine;
40
- }
41
- }
42
- /**
43
- * Gets the number of mines in a particular (x, y) coordinate
44
- * of the matrix.
45
- * @param {number} x - The x coordinate (row).
46
- * @param {number} y - The y coordinate (column).
47
- * @returns {string}
48
- */
49
- getNumberOfMines(x, y) {
50
- if (this.matrix[x][y] === this.types.mine) return this.types.mine;
51
- let counter = 0;
52
- const hasLeft = y > 0;
53
- const hasRight = y < (this.columns - 1);
54
- const hasTop = x > 0;
55
- const hasBottom = x < (this.rows - 1);
56
- counter += +(hasTop && hasLeft && this.matrix[x - 1][y - 1] === this.types.mine);
57
- counter += +(hasTop && this.matrix[x - 1][y] === this.types.mine);
58
- counter += +(hasTop && hasRight && this.matrix[x - 1][y + 1] === this.types.mine);
59
- counter += +(hasLeft && this.matrix[x][y - 1] === this.types.mine);
60
- counter += +(hasRight && this.matrix[x][y + 1] === this.types.mine);
61
- counter += +(hasBottom && hasLeft && this.matrix[x + 1][y - 1] === this.types.mine);
62
- counter += +(hasBottom && this.matrix[x + 1][y] === this.types.mine);
63
- counter += +(hasBottom && hasRight && this.matrix[x + 1][y + 1] === this.types.mine);
64
- return this.types.numbers[counter];
65
- }
66
-
67
- /**
68
- * Generates a minesweeper mine field and returns it.
69
- * @returns {(string | string[][] | null)}
70
- */
71
- start() {
72
- if (this.rows * this.columns <= this.mines * 2) return null;
73
- for (const n of [ "generateEmptyMatrix", "plantMines" ]) this[n]();
74
- this.matrix = this.matrix.map((row, x) => row.map((col, y) => this.getNumberOfMines(x, y)));
75
- return this.matrix;
76
- }
77
- };
@@ -1,8 +0,0 @@
1
- module.exports = (objects) => {
2
- let randomNumber = Math.random() * objects.reduce((agg, object) => agg + object.weight, 0),
3
- weightSum = 0;
4
- return objects.find(o => {
5
- weightSum += o.weight;
6
- return randomNumber <= weightSum;
7
- });
8
- }
@@ -1,300 +0,0 @@
1
- let wordList = [
2
- "ability","able","aboard","about","above","accept","accident","according",
3
- "account","accurate","acres","across","act","action","active","activity",
4
- "actual","actually","add","addition","additional","adjective","adult","adventure",
5
- "advice","affect","afraid","after","afternoon","again","against","age",
6
- "ago","agree","ahead","aid","air","airplane","alike","alive",
7
- "all","allow","almost","alone","along","aloud","alphabet","already",
8
- "also","although","am","among","amount","ancient","angle","angry",
9
- "animal","announced","another","answer","ants","any","anybody","anyone",
10
- "anything","anyway","anywhere","apart","apartment","appearance","apple","applied",
11
- "appropriate","are","area","arm","army","around","arrange","arrangement",
12
- "arrive","arrow","art","article","as","aside","ask","asleep",
13
- "at","ate","atmosphere","atom","atomic","attached","attack","attempt",
14
- "attention","audience","author","automobile","available","average","avoid","aware",
15
- "away","baby","back","bad","badly","bag","balance","ball",
16
- "balloon","band","bank","bar","bare","bark","barn","base",
17
- "baseball","basic","basis","basket","bat","battle","be","bean",
18
- "bear","beat","beautiful","beauty","became","because","become","becoming",
19
- "bee","been","before","began","beginning","begun","behavior","behind",
20
- "being","believed","bell","belong","below","belt","bend","beneath",
21
- "bent","beside","best","bet","better","between","beyond","bicycle",
22
- "bigger","biggest","bill","birds","birth","birthday","bit","bite",
23
- "black","blank","blanket","blew","blind","block","blood","blow",
24
- "blue","board","boat","body","bone","book","border","born",
25
- "both","bottle","bottom","bound","bow","bowl","box","boy",
26
- "brain","branch","brass","brave","bread","break","breakfast","breath",
27
- "breathe","breathing","breeze","brick","bridge","brief","bright","bring",
28
- "broad","broke","broken","brother","brought","brown","brush","buffalo",
29
- "build","building","built","buried","burn","burst","bus","bush",
30
- "business","busy","but","butter","buy","by","cabin","cage",
31
- "cake","call","calm","came","camera","camp","can","canal",
32
- "cannot","cap","capital","captain","captured","car","carbon","card",
33
- "care","careful","carefully","carried","carry","case","cast","castle",
34
- "cat","catch","cattle","caught","cause","cave","cell","cent",
35
- "center","central","century","certain","certainly","chain","chair","chamber",
36
- "chance","change","changing","chapter","character","characteristic","charge","chart",
37
- "check","cheese","chemical","chest","chicken","chief","child","children",
38
- "choice","choose","chose","chosen","church","circle","circus","citizen",
39
- "city","class","classroom","claws","clay","clean","clear","clearly",
40
- "climate","climb","clock","close","closely","closer","cloth","clothes",
41
- "clothing","cloud","club","coach","coal","coast","coat","coffee",
42
- "cold","collect","college","colony","color","column","combination","combine",
43
- "come","comfortable","coming","command","common","community","company","compare",
44
- "compass","complete","completely","complex","composed","composition","compound","concerned",
45
- "condition","congress","connected","consider","consist","consonant","constantly","construction",
46
- "contain","continent","continued","contrast","control","conversation","cook","cookies",
47
- "cool","copper","copy","corn","corner","correct","correctly","cost",
48
- "cotton","could","count","country","couple","courage","course","court",
49
- "cover","cow","cowboy","crack","cream","create","creature","crew",
50
- "crop","cross","crowd","cry","cup","curious","current","curve",
51
- "customs","cut","cutting","daily","damage","dance","danger","dangerous",
52
- "dark","darkness","date","daughter","dawn","day","dead","deal",
53
- "dear","death","decide","declared","deep","deeply","deer","definition",
54
- "degree","depend","depth","describe","desert","design","desk","detail",
55
- "determine","develop","development","diagram","diameter","did","die","differ",
56
- "difference","different","difficult","difficulty","dig","dinner","direct","direction",
57
- "directly","dirt","dirty","disappear","discover","discovery","discuss","discussion",
58
- "disease","dish","distance","distant","divide","division","do","doctor",
59
- "does","dog","doing","doll","dollar","done","donkey","door",
60
- "dot","double","doubt","down","dozen","draw","drawn","dream",
61
- "dress","drew","dried","drink","drive","driven","driver","driving",
62
- "drop","dropped","drove","dry","duck","due","dug","dull",
63
- "during","dust","duty","each","eager","ear","earlier","early",
64
- "earn","earth","easier","easily","east","easy","eat","eaten",
65
- "edge","education","effect","effort","egg","eight","either","electric",
66
- "electricity","element","elephant","eleven","else","empty","end","enemy",
67
- "energy","engine","engineer","enjoy","enough","enter","entire","entirely",
68
- "environment","equal","equally","equator","equipment","escape","especially","essential",
69
- "establish","even","evening","event","eventually","ever","every","everybody",
70
- "everyone","everything","everywhere","evidence","exact","exactly","examine","example",
71
- "excellent","except","exchange","excited","excitement","exciting","exclaimed","exercise",
72
- "exist","expect","experience","experiment","explain","explanation","explore","express",
73
- "expression","extra","eye","face","facing","fact","factor","factory",
74
- "failed","fair","fairly","fall","fallen","familiar","family","famous",
75
- "far","farm","farmer","farther","fast","fastened","faster","fat",
76
- "father","favorite","fear","feathers","feature","fed","feed","feel",
77
- "feet","fell","fellow","felt","fence","few","fewer","field",
78
- "fierce","fifteen","fifth","fifty","fight","fighting","figure","fill",
79
- "film","final","finally","find","fine","finest","finger","finish",
80
- "fire","fireplace","firm","first","fish","five","fix","flag",
81
- "flame","flat","flew","flies","flight","floating","floor","flow",
82
- "flower","fly","fog","folks","follow","food","foot","football",
83
- "for","force","foreign","forest","forget","forgot","forgotten","form",
84
- "former","fort","forth","forty","forward","fought","found","four",
85
- "fourth","fox","frame","free","freedom","frequently","fresh","friend",
86
- "friendly","frighten","frog","from","front","frozen","fruit","fuel",
87
- "full","fully","fun","function","funny","fur","furniture","further",
88
- "future","gain","game","garage","garden","gas","gasoline","gate",
89
- "gather","gave","general","generally","gentle","gently","get","getting",
90
- "giant","gift","girl","give","given","giving","glad","glass",
91
- "globe","go","goes","gold","golden","gone","good","goose",
92
- "got","government","grabbed","grade","gradually","grain","grandfather","grandmother",
93
- "graph","grass","gravity","gray","great","greater","greatest","greatly",
94
- "green","grew","ground","group","grow","grown","growth","guard",
95
- "guess","guide","gulf","gun","habit","had","hair","half",
96
- "halfway","hall","hand","handle","handsome","hang","happen","happened",
97
- "happily","happy","harbor","hard","harder","hardly","has","hat",
98
- "have","having","hay","he","headed","heading","health","heard",
99
- "hearing","heart","heat","heavy","height","held","hello","help",
100
- "helpful","her","herd","here","herself","hidden","hide","high",
101
- "higher","highest","highway","hill","him","himself","his","history",
102
- "hit","hold","hole","hollow","home","honor","hope","horn",
103
- "horse","hospital","hot","hour","house","how","however","huge",
104
- "human","hundred","hung","hungry","hunt","hunter","hurried","hurry",
105
- "hurt","husband","ice","idea","identity","if","ill","image",
106
- "imagine","immediately","importance","important","impossible","improve","in","inch",
107
- "include","including","income","increase","indeed","independent","indicate","individual",
108
- "industrial","industry","influence","information","inside","instance","instant","instead",
109
- "instrument","interest","interior","into","introduced","invented","involved","iron",
110
- "is","island","it","its","itself","jack","jar","jet",
111
- "job","join","joined","journey","joy","judge","jump","jungle",
112
- "just","keep","kept","key","kids","kill","kind","kitchen",
113
- "knew","knife","know","knowledge","known","label","labor","lack",
114
- "lady","laid","lake","lamp","land","language","large","larger",
115
- "largest","last","late","later","laugh","law","lay","layers",
116
- "lead","leader","leaf","learn","least","leather","leave","leaving",
117
- "led","left","leg","length","lesson","let","letter","level",
118
- "library","lie","life","lift","light","like","likely","limited",
119
- "line","lion","lips","liquid","list","listen","little","live",
120
- "living","load","local","locate","location","log","lonely","long",
121
- "longer","look","loose","lose","loss","lost","lot","loud",
122
- "love","lovely","low","lower","luck","lucky","lunch","lungs",
123
- "lying","machine","machinery","mad","made","magic","magnet","mail",
124
- "main","mainly","major","make","making","man","managed","manner",
125
- "manufacturing","many","map","mark","market","married","mass","massage",
126
- "master","material","mathematics","matter","may","maybe","me","meal",
127
- "mean","means","meant","measure","meat","medicine","meet","melted",
128
- "member","memory","men","mental","merely","met","metal","method",
129
- "mice","middle","might","mighty","mile","military","milk","mill",
130
- "mind","mine","minerals","minute","mirror","missing","mission","mistake",
131
- "mix","mixture","model","modern","molecular","moment","money","monkey",
132
- "month","mood","moon","more","morning","most","mostly","mother",
133
- "motion","motor","mountain","mouse","mouth","move","movement","movie",
134
- "moving","mud","muscle","music","musical","must","my","myself",
135
- "mysterious","nails","name","nation","national","native","natural","naturally",
136
- "nature","near","nearby","nearer","nearest","nearly","necessary","neck",
137
- "needed","needle","needs","negative","neighbor","neighborhood","nervous","nest",
138
- "never","new","news","newspaper","next","nice","night","nine",
139
- "no","nobody","nodded","noise","none","noon","nor","north",
140
- "nose","not","note","noted","nothing","notice","noun","now",
141
- "number","numeral","nuts","object","observe","obtain","occasionally","occur",
142
- "ocean","of","off","offer","office","officer","official","oil",
143
- "old","older","oldest","on","once","one","only","onto",
144
- "open","operation","opinion","opportunity","opposite","or","orange","orbit",
145
- "order","ordinary","organization","organized","origin","original","other","ought",
146
- "our","ourselves","out","outer","outline","outside","over","own",
147
- "owner","oxygen","pack","package","page","paid","pain","paint",
148
- "pair","palace","pale","pan","paper","paragraph","parallel","parent",
149
- "park","part","particles","particular","particularly","partly","parts","party",
150
- "pass","passage","past","path","pattern","pay","peace","pen",
151
- "pencil","people","per","percent","perfect","perfectly","perhaps","period",
152
- "person","personal","pet","phrase","physical","piano","pick","picture",
153
- "pictured","pie","piece","pig","pile","pilot","pine","pink",
154
- "pipe","pitch","place","plain","plan","plane","planet","planned",
155
- "planning","plant","plastic","plate","plates","play","pleasant","please",
156
- "pleasure","plenty","plural","plus","pocket","poem","poet","poetry",
157
- "point","pole","police","policeman","political","pond","pony","pool",
158
- "poor","popular","population","porch","port","position","positive","possible",
159
- "possibly","post","pot","potatoes","pound","pour","powder","power",
160
- "powerful","practical","practice","prepare","present","president","press","pressure",
161
- "pretty","prevent","previous","price","pride","primitive","principal","principle",
162
- "printed","private","prize","probably","problem","process","produce","product",
163
- "production","program","progress","promised","proper","properly","property","protection",
164
- "proud","prove","provide","public","pull","pupil","pure","purple",
165
- "purpose","push","put","putting","quarter","queen","question","quick",
166
- "quickly","quiet","quietly","quite","rabbit","race","radio","railroad",
167
- "rain","raise","ran","ranch","range","rapidly","rate","rather",
168
- "raw","rays","reach","read","reader","ready","real","realize",
169
- "rear","reason","recall","receive","recent","recently","recognize","record",
170
- "red","refer","refused","region","regular","related","relationship","religious",
171
- "remain","remarkable","remember","remove","repeat","replace","replied","report",
172
- "represent","require","research","respect","rest","result","return","review",
173
- "rhyme","rhythm","rice","rich","ride","riding","right","ring",
174
- "rise","rising","river","road","roar","rock","rocket","rocky",
175
- "rod","roll","roof","room","root","rope","rose","rough",
176
- "round","route","row","rubbed","rubber","rule","ruler","run",
177
- "running","rush","sad","saddle","safe","safety","said","sail",
178
- "sale","salmon","salt","same","sand","sang","sat","satellites",
179
- "satisfied","save","saved","saw","say","scale","scared","scene",
180
- "school","science","scientific","scientist","score","screen","sea","search",
181
- "season","seat","second","secret","section","see","seed","seeing",
182
- "seems","seen","seldom","select","selection","sell","send","sense",
183
- "sent","sentence","separate","series","serious","serve","service","sets",
184
- "setting","settle","settlers","seven","several","shade","shadow","shake",
185
- "shaking","shall","shallow","shape","share","sharp","she","sheep",
186
- "sheet","shelf","shells","shelter","shine","shinning","ship","shirt",
187
- "shoe","shoot","shop","shore","short","shorter","shot","should",
188
- "shoulder","shout","show","shown","shut","sick","sides","sight",
189
- "sign","signal","silence","silent","silk","silly","silver","similar",
190
- "simple","simplest","simply","since","sing","single","sink","sister",
191
- "sit","sitting","situation","six","size","skill","skin","sky",
192
- "slabs","slave","sleep","slept","slide","slight","slightly","slip",
193
- "slipped","slope","slow","slowly","small","smaller","smallest","smell",
194
- "smile","smoke","smooth","snake","snow","so","soap","social",
195
- "society","soft","softly","soil","solar","sold","soldier","solid",
196
- "solution","solve","some","somebody","somehow","someone","something","sometime",
197
- "somewhere","son","song","soon","sort","sound","source","south",
198
- "southern","space","speak","special","species","specific","speech","speed",
199
- "spell","spend","spent","spider","spin","spirit","spite","split",
200
- "spoken","sport","spread","spring","square","stage","stairs","stand",
201
- "standard","star","stared","start","state","statement","station","stay",
202
- "steady","steam","steel","steep","stems","step","stepped","stick",
203
- "stiff","still","stock","stomach","stone","stood","stop","stopped",
204
- "store","storm","story","stove","straight","strange","stranger","straw",
205
- "stream","street","strength","stretch","strike","string","strip","strong",
206
- "stronger","struck","structure","struggle","stuck","student","studied","studying",
207
- "subject","substance","success","successful","such","sudden","suddenly","sugar",
208
- "suggest","suit","sum","summer","sun","sunlight","supper","supply",
209
- "support","suppose","sure","surface","surprise","surrounded","swam","sweet",
210
- "swept","swim","swimming","swing","swung","syllable","symbol","system",
211
- "table","tail","take","taken","tales","talk","tall","tank",
212
- "tape","task","taste","taught","tax","tea","teach","teacher",
213
- "team","tears","teeth","telephone","television","tell","temperature","ten",
214
- "tent","term","terrible","test","than","thank","that","thee",
215
- "them","themselves","then","theory","there","therefore","these","they",
216
- "thick","thin","thing","think","third","thirty","this","those",
217
- "thou","though","thought","thousand","thread","three","threw","throat",
218
- "through","throughout","throw","thrown","thumb","thus","thy","tide",
219
- "tie","tight","tightly","till","time","tin","tiny","tip",
220
- "tired","title","to","tobacco","today","together","told","tomorrow",
221
- "tone","tongue","tonight","too","took","tool","top","topic",
222
- "torn","total","touch","toward","tower","town","toy","trace",
223
- "track","trade","traffic","trail","train","transportation","trap","travel",
224
- "treated","tree","triangle","tribe","trick","tried","trip","troops",
225
- "tropical","trouble","truck","trunk","truth","try","tube","tune",
226
- "turn","twelve","twenty","twice","two","type","typical","uncle",
227
- "under","underline","understanding","unhappy","union","unit","universe","unknown",
228
- "unless","until","unusual","up","upon","upper","upward","us",
229
- "use","useful","using","usual","usually","valley","valuable","value",
230
- "vapor","variety","various","vast","vegetable","verb","vertical","very",
231
- "vessels","victory","view","village","visit","visitor","voice","volume",
232
- "vote","vowel","voyage","wagon","wait","walk","wall","want",
233
- "war","warm","warn","was","wash","waste","watch","water",
234
- "wave","way","we","weak","wealth","wear","weather","week",
235
- "weigh","weight","welcome","well","went","were","west","western",
236
- "wet","whale","what","whatever","wheat","wheel","when","whenever",
237
- "where","wherever","whether","which","while","whispered","whistle","white",
238
- "who","whole","whom","whose","why","wide","widely","wife",
239
- "wild","will","willing","win","wind","window","wing","winter",
240
- "wire","wise","wish","with","within","without","wolf","women",
241
- "won","wonder","wonderful","wood","wooden","wool","word","wore",
242
- "work","worker","world","worried","worry","worse","worth","would",
243
- "wrapped","write","writer","writing","written","wrong","wrote","yard",
244
- "year","yellow","yes","yesterday","yet","you","young","younger",
245
- "your","yourself","youth","zero","zebra","zipper","zoo","zulu"
246
- ];
247
-
248
- module.exports = (options) => {
249
-
250
- const [
251
- randInt, generateRandomWord, generateWordWithMaxLength,
252
- ] = [
253
- (less) => Math.floor(Math.random() * less),
254
- () => wordList[randInt(wordList.length)],
255
- () => {
256
- let [ rightSize, wordUsed ] = [ false, undefined ];
257
- while (!rightSize) {
258
- wordUsed = generateRandomWord();
259
- if(wordUsed.length <= options.maxLength) rightSize = true;
260
- }
261
- return wordUsed;
262
- }
263
- ],
264
- word = () => {
265
- if (options && options.maxLength > 1) return generateWordWithMaxLength();
266
- else return generateRandomWord();
267
- }
268
- if (!options) return word();
269
- if (typeof options === "number") options = { exactly: options };
270
-
271
- if (options.exactly) {
272
- options.min = options.exactly;
273
- options.max = options.exactly;
274
- }
275
-
276
- if (typeof options.wordsPerString !== 'number') options.wordsPerString = 1;
277
- if (typeof options.formatter !== 'function') options.formatter = (word) => word;
278
- if (typeof options.separator !== 'string') options.separator = ' ';
279
- let [ total, results, token, relativeIndex ] = [
280
- options.min + randInt((options.max + 1) - options.min),
281
- [],
282
- "",
283
- 0
284
- ]
285
-
286
- for (let i = 0; (i < total * options.wordsPerString); i++) {
287
- if (relativeIndex === options.wordsPerString - 1) token += options.formatter(word(), relativeIndex);
288
- else token += options.formatter(word(), relativeIndex) + options.separator;
289
- relativeIndex++;
290
- if ((i + 1) % options.wordsPerString === 0) {
291
- results.push(token);
292
- token = '';
293
- relativeIndex = 0;
294
- }
295
-
296
- }
297
- if (typeof options.join === 'string') results = results.join(options.join);
298
-
299
- return results;
300
- };