tiny-essentials 1.0.0

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 (302) hide show
  1. package/.github/FUNDING.yml +4 -0
  2. package/.github/workflows/node.js.yml +31 -0
  3. package/LICENSE +674 -0
  4. package/README.md +67 -0
  5. package/dist/TinyEssentials.min.js +1 -0
  6. package/dist/_virtual/_commonjsHelpers.cjs +7 -0
  7. package/dist/_virtual/common.cjs +5 -0
  8. package/dist/_virtual/index.cjs +9 -0
  9. package/dist/_virtual/index2.cjs +5 -0
  10. package/dist/_virtual/trace.cjs +5 -0
  11. package/dist/legacy/crypto/decrypt.cjs +57 -0
  12. package/dist/legacy/crypto/decrypt.d.mts +18 -0
  13. package/dist/legacy/crypto/decrypt.mjs +47 -0
  14. package/dist/legacy/crypto/default.cjs +23 -0
  15. package/dist/legacy/crypto/default.d.mts +35 -0
  16. package/dist/legacy/crypto/default.mjs +19 -0
  17. package/dist/legacy/crypto/encrypt.cjs +54 -0
  18. package/dist/legacy/crypto/encrypt.d.mts +19 -0
  19. package/dist/legacy/crypto/encrypt.mjs +46 -0
  20. package/dist/legacy/crypto/index.cjs +11 -0
  21. package/dist/legacy/crypto/index.d.mts +4 -0
  22. package/dist/legacy/crypto/index.mjs +6 -0
  23. package/dist/legacy/firebase/cookieSession.cjs +121 -0
  24. package/dist/legacy/firebase/cookieSession.d.mts +56 -0
  25. package/dist/legacy/firebase/cookieSession.mjs +114 -0
  26. package/dist/legacy/firebase/database/index.cjs +11 -0
  27. package/dist/legacy/firebase/database/index.d.mts +7 -0
  28. package/dist/legacy/firebase/database/index.mjs +7 -0
  29. package/dist/legacy/firebase/database/presence.cjs +131 -0
  30. package/dist/legacy/firebase/database/presence.d.mts +9 -0
  31. package/dist/legacy/firebase/database/presence.mjs +111 -0
  32. package/dist/legacy/firebase/database/saveAsync.cjs +147 -0
  33. package/dist/legacy/firebase/database/saveAsync.d.mts +54 -0
  34. package/dist/legacy/firebase/database/saveAsync.mjs +147 -0
  35. package/dist/legacy/firebase/databaseEscape.cjs +42 -0
  36. package/dist/legacy/firebase/databaseEscape.d.mts +11 -0
  37. package/dist/legacy/firebase/databaseEscape.mjs +37 -0
  38. package/dist/legacy/firebase/databaseLogger.cjs +258 -0
  39. package/dist/legacy/firebase/databaseLogger.d.mts +7 -0
  40. package/dist/legacy/firebase/databaseLogger.mjs +234 -0
  41. package/dist/legacy/firebase/discord/api/addGuildMember.cjs +71 -0
  42. package/dist/legacy/firebase/discord/api/addGuildMember.d.mts +38 -0
  43. package/dist/legacy/firebase/discord/api/addGuildMember.mjs +64 -0
  44. package/dist/legacy/firebase/discord/api/getGuildWidget.cjs +47 -0
  45. package/dist/legacy/firebase/discord/api/getGuildWidget.d.mts +17 -0
  46. package/dist/legacy/firebase/discord/api/getGuildWidget.mjs +43 -0
  47. package/dist/legacy/firebase/discord/api/getToken.cjs +67 -0
  48. package/dist/legacy/firebase/discord/api/getToken.d.mts +35 -0
  49. package/dist/legacy/firebase/discord/api/getToken.mjs +63 -0
  50. package/dist/legacy/firebase/discord/api/getUser.cjs +58 -0
  51. package/dist/legacy/firebase/discord/api/getUser.d.mts +27 -0
  52. package/dist/legacy/firebase/discord/api/getUser.mjs +54 -0
  53. package/dist/legacy/firebase/discord/api/getUserConnections.cjs +57 -0
  54. package/dist/legacy/firebase/discord/api/getUserConnections.d.mts +26 -0
  55. package/dist/legacy/firebase/discord/api/getUserConnections.mjs +53 -0
  56. package/dist/legacy/firebase/discord/api/getUserGuilds.cjs +56 -0
  57. package/dist/legacy/firebase/discord/api/getUserGuilds.d.mts +25 -0
  58. package/dist/legacy/firebase/discord/api/getUserGuilds.mjs +52 -0
  59. package/dist/legacy/firebase/discord/api/index.cjs +24 -0
  60. package/dist/legacy/firebase/discord/api/index.d.mts +19 -0
  61. package/dist/legacy/firebase/discord/api/index.mjs +20 -0
  62. package/dist/legacy/firebase/discord/api/refreshToken.cjs +77 -0
  63. package/dist/legacy/firebase/discord/api/refreshToken.d.mts +45 -0
  64. package/dist/legacy/firebase/discord/api/refreshToken.mjs +73 -0
  65. package/dist/legacy/firebase/discord/api/revokeToken.cjs +61 -0
  66. package/dist/legacy/firebase/discord/api/revokeToken.d.mts +29 -0
  67. package/dist/legacy/firebase/discord/api/revokeToken.mjs +58 -0
  68. package/dist/legacy/firebase/discord/config.cjs +21 -0
  69. package/dist/legacy/firebase/discord/config.d.mts +27 -0
  70. package/dist/legacy/firebase/discord/config.mjs +17 -0
  71. package/dist/legacy/firebase/discord/firebase_redirect/index.cjs +11 -0
  72. package/dist/legacy/firebase/discord/firebase_redirect/index.d.mts +7 -0
  73. package/dist/legacy/firebase/discord/firebase_redirect/index.mjs +7 -0
  74. package/dist/legacy/firebase/discord/firebase_redirect/login.cjs +110 -0
  75. package/dist/legacy/firebase/discord/firebase_redirect/login.d.mts +4 -0
  76. package/dist/legacy/firebase/discord/firebase_redirect/login.mjs +107 -0
  77. package/dist/legacy/firebase/discord/firebase_redirect/logout.cjs +100 -0
  78. package/dist/legacy/firebase/discord/firebase_redirect/logout.d.mts +4 -0
  79. package/dist/legacy/firebase/discord/firebase_redirect/logout.mjs +97 -0
  80. package/dist/legacy/firebase/discord/get/authURLGenerator.cjs +76 -0
  81. package/dist/legacy/firebase/discord/get/authURLGenerator.d.mts +23 -0
  82. package/dist/legacy/firebase/discord/get/authURLGenerator.mjs +67 -0
  83. package/dist/legacy/firebase/discord/get/cookie-session.cjs +32 -0
  84. package/dist/legacy/firebase/discord/get/cookie-session.d.mts +20 -0
  85. package/dist/legacy/firebase/discord/get/cookie-session.mjs +28 -0
  86. package/dist/legacy/firebase/discord/get/credentials.cjs +24 -0
  87. package/dist/legacy/firebase/discord/get/credentials.d.mts +19 -0
  88. package/dist/legacy/firebase/discord/get/credentials.mjs +20 -0
  89. package/dist/legacy/firebase/discord/get/errorValidator.cjs +60 -0
  90. package/dist/legacy/firebase/discord/get/errorValidator.d.mts +28 -0
  91. package/dist/legacy/firebase/discord/get/errorValidator.mjs +55 -0
  92. package/dist/legacy/firebase/discord/get/index.cjs +17 -0
  93. package/dist/legacy/firebase/discord/get/index.d.mts +13 -0
  94. package/dist/legacy/firebase/discord/get/index.mjs +13 -0
  95. package/dist/legacy/firebase/discord/get/randomAvatar.cjs +37 -0
  96. package/dist/legacy/firebase/discord/get/randomAvatar.d.mts +22 -0
  97. package/dist/legacy/firebase/discord/get/randomAvatar.mjs +30 -0
  98. package/dist/legacy/firebase/discord/http/index.cjs +15 -0
  99. package/dist/legacy/firebase/discord/http/index.d.mts +11 -0
  100. package/dist/legacy/firebase/discord/http/index.mjs +11 -0
  101. package/dist/legacy/firebase/discord/http/login.cjs +127 -0
  102. package/dist/legacy/firebase/discord/http/login.d.mts +21 -0
  103. package/dist/legacy/firebase/discord/http/login.mjs +123 -0
  104. package/dist/legacy/firebase/discord/http/logout.cjs +155 -0
  105. package/dist/legacy/firebase/discord/http/logout.d.mts +22 -0
  106. package/dist/legacy/firebase/discord/http/logout.mjs +143 -0
  107. package/dist/legacy/firebase/discord/http/redirect.cjs +188 -0
  108. package/dist/legacy/firebase/discord/http/redirect.d.mts +24 -0
  109. package/dist/legacy/firebase/discord/http/redirect.mjs +178 -0
  110. package/dist/legacy/firebase/discord/http/refreshToken.cjs +133 -0
  111. package/dist/legacy/firebase/discord/http/refreshToken.d.mts +24 -0
  112. package/dist/legacy/firebase/discord/http/refreshToken.mjs +121 -0
  113. package/dist/legacy/firebase/discord/index.cjs +19 -0
  114. package/dist/legacy/firebase/discord/index.d.mts +15 -0
  115. package/dist/legacy/firebase/discord/index.mjs +15 -0
  116. package/dist/legacy/firebase/discord/template/cookie-session.cjs +1430 -0
  117. package/dist/legacy/firebase/discord/template/cookie-session.d.mts +22 -0
  118. package/dist/legacy/firebase/discord/template/cookie-session.mjs +1159 -0
  119. package/dist/legacy/firebase/domainRedirect.cjs +35 -0
  120. package/dist/legacy/firebase/domainRedirect.d.mts +12 -0
  121. package/dist/legacy/firebase/domainRedirect.mjs +27 -0
  122. package/dist/legacy/firebase/escape.cjs +75 -0
  123. package/dist/legacy/firebase/escape.d.mts +17 -0
  124. package/dist/legacy/firebase/escape.mjs +58 -0
  125. package/dist/legacy/firebase/getDBAsync.cjs +33 -0
  126. package/dist/legacy/firebase/getDBAsync.d.mts +10 -0
  127. package/dist/legacy/firebase/getDBAsync.mjs +26 -0
  128. package/dist/legacy/firebase/getDBData.cjs +21 -0
  129. package/dist/legacy/firebase/getDBData.d.mts +1 -0
  130. package/dist/legacy/firebase/getDBData.mjs +17 -0
  131. package/dist/legacy/firebase/getDBValue.cjs +17 -0
  132. package/dist/legacy/firebase/getDBValue.d.mts +9 -0
  133. package/dist/legacy/firebase/getDBValue.mjs +14 -0
  134. package/dist/legacy/firebase/index.cjs +261 -0
  135. package/dist/legacy/firebase/index.d.mts +51 -0
  136. package/dist/legacy/firebase/index.mjs +234 -0
  137. package/dist/legacy/firebase/isEmulator.cjs +14 -0
  138. package/dist/legacy/firebase/isEmulator.d.mts +8 -0
  139. package/dist/legacy/firebase/isEmulator.mjs +10 -0
  140. package/dist/legacy/firebase/logger.cjs +137 -0
  141. package/dist/legacy/firebase/logger.d.mts +7 -0
  142. package/dist/legacy/firebase/logger.mjs +125 -0
  143. package/dist/legacy/firebase/mySQL.cjs +26 -0
  144. package/dist/legacy/firebase/mySQL.d.mts +10 -0
  145. package/dist/legacy/firebase/mySQL.mjs +22 -0
  146. package/dist/legacy/firebase/mysqlConnector/create.cjs +119 -0
  147. package/dist/legacy/firebase/mysqlConnector/create.d.mts +36 -0
  148. package/dist/legacy/firebase/mysqlConnector/create.mjs +109 -0
  149. package/dist/legacy/firebase/mysqlConnector/index.cjs +23 -0
  150. package/dist/legacy/firebase/mysqlConnector/index.d.mts +11 -0
  151. package/dist/legacy/firebase/mysqlConnector/index.mjs +16 -0
  152. package/dist/legacy/firebase/mysqlConnector/nextPrev.cjs +75 -0
  153. package/dist/legacy/firebase/mysqlConnector/nextPrev.d.mts +31 -0
  154. package/dist/legacy/firebase/mysqlConnector/nextPrev.mjs +63 -0
  155. package/dist/legacy/firebase/mysqlConnector/pagination.cjs +91 -0
  156. package/dist/legacy/firebase/mysqlConnector/pagination.d.mts +33 -0
  157. package/dist/legacy/firebase/mysqlConnector/pagination.mjs +87 -0
  158. package/dist/legacy/firebase/mysqlConnector/sameUser.cjs +28 -0
  159. package/dist/legacy/firebase/mysqlConnector/sameUser.d.mts +12 -0
  160. package/dist/legacy/firebase/mysqlConnector/sameUser.mjs +23 -0
  161. package/dist/legacy/firebase/transactionDBAsync.cjs +33 -0
  162. package/dist/legacy/firebase/transactionDBAsync.d.mts +11 -0
  163. package/dist/legacy/firebase/transactionDBAsync.mjs +27 -0
  164. package/dist/legacy/get/countObj.cjs +24 -0
  165. package/dist/legacy/get/countObj.d.mts +11 -0
  166. package/dist/legacy/get/countObj.mjs +21 -0
  167. package/dist/legacy/get/decimalColor.cjs +60 -0
  168. package/dist/legacy/get/decimalColor.d.mts +12 -0
  169. package/dist/legacy/get/decimalColor.mjs +54 -0
  170. package/dist/legacy/get/objType.cjs +43 -0
  171. package/dist/legacy/get/objType.d.mts +19 -0
  172. package/dist/legacy/get/objType.mjs +40 -0
  173. package/dist/legacy/get/pagination.cjs +100 -0
  174. package/dist/legacy/get/pagination.d.mts +25 -0
  175. package/dist/legacy/get/pagination.mjs +91 -0
  176. package/dist/legacy/get/queryUrlByName.cjs +31 -0
  177. package/dist/legacy/get/queryUrlByName.d.mts +20 -0
  178. package/dist/legacy/get/queryUrlByName.mjs +28 -0
  179. package/dist/legacy/get/queryUrlJSON.cjs +54 -0
  180. package/dist/legacy/get/queryUrlJSON.d.mts +23 -0
  181. package/dist/legacy/get/queryUrlJSON.mjs +57 -0
  182. package/dist/legacy/get/super_string_filter.cjs +97 -0
  183. package/dist/legacy/get/super_string_filter.d.mts +25 -0
  184. package/dist/legacy/get/super_string_filter.mjs +83 -0
  185. package/dist/legacy/get/versionCheck.cjs +49 -0
  186. package/dist/legacy/get/versionCheck.d.mts +17 -0
  187. package/dist/legacy/get/versionCheck.mjs +38 -0
  188. package/dist/legacy/http/HTTP-1.0.cjs +151 -0
  189. package/dist/legacy/http/HTTP-1.0.d.mts +8 -0
  190. package/dist/legacy/http/HTTP-1.0.mjs +136 -0
  191. package/dist/legacy/http/auth.cjs +70 -0
  192. package/dist/legacy/http/auth.d.mts +41 -0
  193. package/dist/legacy/http/auth.mjs +63 -0
  194. package/dist/legacy/http/check_domain.cjs +84 -0
  195. package/dist/legacy/http/check_domain.d.mts +10 -0
  196. package/dist/legacy/http/check_domain.mjs +82 -0
  197. package/dist/legacy/http/csrfTokenAnalyze.cjs +46 -0
  198. package/dist/legacy/http/csrfTokenAnalyze.d.mts +21 -0
  199. package/dist/legacy/http/csrfTokenAnalyze.mjs +40 -0
  200. package/dist/legacy/http/domainValidator.cjs +98 -0
  201. package/dist/legacy/http/domainValidator.d.mts +30 -0
  202. package/dist/legacy/http/domainValidator.mjs +82 -0
  203. package/dist/legacy/http/errorsCallback.cjs +55 -0
  204. package/dist/legacy/http/errorsCallback.d.mts +29 -0
  205. package/dist/legacy/http/errorsCallback.mjs +48 -0
  206. package/dist/legacy/http/fetch/json.cjs +48 -0
  207. package/dist/legacy/http/fetch/json.d.mts +22 -0
  208. package/dist/legacy/http/fetch/json.mjs +41 -0
  209. package/dist/legacy/http/fetch/text.cjs +47 -0
  210. package/dist/legacy/http/fetch/text.d.mts +21 -0
  211. package/dist/legacy/http/fetch/text.mjs +40 -0
  212. package/dist/legacy/http/fileCache.cjs +79 -0
  213. package/dist/legacy/http/fileCache.d.mts +35 -0
  214. package/dist/legacy/http/fileCache.mjs +70 -0
  215. package/dist/legacy/http/getDomainURL.cjs +59 -0
  216. package/dist/legacy/http/getDomainURL.d.mts +18 -0
  217. package/dist/legacy/http/getDomainURL.mjs +54 -0
  218. package/dist/legacy/http/userIP.cjs +59 -0
  219. package/dist/legacy/http/userIP.d.mts +21 -0
  220. package/dist/legacy/http/userIP.mjs +48 -0
  221. package/dist/legacy/index.cjs +122 -0
  222. package/dist/legacy/index.d.mts +89 -0
  223. package/dist/legacy/index.mjs +92 -0
  224. package/dist/legacy/libs/arraySortPositions.cjs +30 -0
  225. package/dist/legacy/libs/arraySortPositions.d.mts +16 -0
  226. package/dist/legacy/libs/arraySortPositions.mjs +27 -0
  227. package/dist/legacy/libs/capitalize.cjs +21 -0
  228. package/dist/legacy/libs/capitalize.d.mts +13 -0
  229. package/dist/legacy/libs/capitalize.mjs +17 -0
  230. package/dist/legacy/libs/convertBytes.cjs +64 -0
  231. package/dist/legacy/libs/convertBytes.d.mts +17 -0
  232. package/dist/legacy/libs/convertBytes.mjs +55 -0
  233. package/dist/legacy/libs/custom_module_loader.cjs +82 -0
  234. package/dist/legacy/libs/custom_module_loader.d.mts +5 -0
  235. package/dist/legacy/libs/custom_module_loader.mjs +79 -0
  236. package/dist/legacy/libs/dice.cjs +35 -0
  237. package/dist/legacy/libs/dice.d.mts +5 -0
  238. package/dist/legacy/libs/dice.mjs +31 -0
  239. package/dist/legacy/libs/markdown.cjs +85 -0
  240. package/dist/legacy/libs/markdown.d.mts +75 -0
  241. package/dist/legacy/libs/markdown.mjs +78 -0
  242. package/dist/legacy/libs/percentage.cjs +22 -0
  243. package/dist/legacy/libs/percentage.d.mts +4 -0
  244. package/dist/legacy/libs/percentage.mjs +19 -0
  245. package/dist/legacy/libs/regex/getLetter.cjs +22 -0
  246. package/dist/legacy/libs/regex/getLetter.d.mts +12 -0
  247. package/dist/legacy/libs/regex/getLetter.mjs +19 -0
  248. package/dist/legacy/libs/replaceAsync.cjs +32 -0
  249. package/dist/legacy/libs/replaceAsync.d.mts +15 -0
  250. package/dist/legacy/libs/replaceAsync.mjs +25 -0
  251. package/dist/legacy/libs/rule3.cjs +58 -0
  252. package/dist/legacy/libs/rule3.d.mts +5 -0
  253. package/dist/legacy/libs/rule3.mjs +54 -0
  254. package/dist/legacy/libs/userLevel.cjs +134 -0
  255. package/dist/legacy/libs/userLevel.d.mts +69 -0
  256. package/dist/legacy/libs/userLevel.mjs +123 -0
  257. package/dist/legacy/momentjs/getAge.cjs +28 -0
  258. package/dist/legacy/momentjs/getAge.d.mts +8 -0
  259. package/dist/legacy/momentjs/getAge.mjs +22 -0
  260. package/dist/legacy/momentjs/index.cjs +9 -0
  261. package/dist/legacy/momentjs/index.d.mts +3 -0
  262. package/dist/legacy/momentjs/index.mjs +3 -0
  263. package/dist/legacy/momentjs/timeDuration.cjs +29 -0
  264. package/dist/legacy/momentjs/timeDuration.d.mts +9 -0
  265. package/dist/legacy/momentjs/timeDuration.mjs +23 -0
  266. package/dist/legacy/socket.io/antiFlood/index.cjs +9 -0
  267. package/dist/legacy/socket.io/antiFlood/index.d.mts +3 -0
  268. package/dist/legacy/socket.io/antiFlood/index.mjs +3 -0
  269. package/dist/legacy/socket.io/antiFlood/install.cjs +32 -0
  270. package/dist/legacy/socket.io/antiFlood/install.d.mts +14 -0
  271. package/dist/legacy/socket.io/antiFlood/install.mjs +27 -0
  272. package/dist/legacy/socket.io/antiFlood/verify.cjs +87 -0
  273. package/dist/legacy/socket.io/antiFlood/verify.d.mts +15 -0
  274. package/dist/legacy/socket.io/antiFlood/verify.mjs +73 -0
  275. package/dist/legacy/socket.io/cookie-session.cjs +25 -0
  276. package/dist/legacy/socket.io/cookie-session.d.mts +9 -0
  277. package/dist/legacy/socket.io/cookie-session.mjs +20 -0
  278. package/dist/legacy/socket.io/discord.cjs +61 -0
  279. package/dist/legacy/socket.io/discord.d.mts +10 -0
  280. package/dist/legacy/socket.io/discord.mjs +52 -0
  281. package/dist/legacy/socket.io/index.cjs +13 -0
  282. package/dist/legacy/socket.io/index.d.mts +9 -0
  283. package/dist/legacy/socket.io/index.mjs +9 -0
  284. package/dist/v1/basics/array.cjs +31 -0
  285. package/dist/v1/basics/array.d.mts +10 -0
  286. package/dist/v1/basics/array.mjs +22 -0
  287. package/dist/v1/basics/clock.cjs +187 -0
  288. package/dist/v1/basics/clock.d.mts +37 -0
  289. package/dist/v1/basics/clock.mjs +152 -0
  290. package/dist/v1/basics/objFilter.cjs +55 -0
  291. package/dist/v1/basics/objFilter.d.mts +27 -0
  292. package/dist/v1/basics/objFilter.mjs +52 -0
  293. package/dist/v1/basics/simpleMath.cjs +88 -0
  294. package/dist/v1/basics/simpleMath.d.mts +54 -0
  295. package/dist/v1/basics/simpleMath.mjs +75 -0
  296. package/dist/v1/basics/text.cjs +34 -0
  297. package/dist/v1/basics/text.d.mts +20 -0
  298. package/dist/v1/basics/text.mjs +25 -0
  299. package/dist/v1/index.cjs +26 -0
  300. package/dist/v1/index.d.mts +15 -0
  301. package/dist/v1/index.mjs +8 -0
  302. package/package.json +72 -0
@@ -0,0 +1,92 @@
1
+ import countObj from './get/countObj.mjs';
2
+ import objType from './get/objType.mjs';
3
+ import super_string_filter from './get/super_string_filter.mjs';
4
+ import auth from './http/auth.mjs';
5
+ import check_domain from './http/check_domain.mjs';
6
+ import domainValidator from './http/domainValidator.mjs';
7
+ import errorsCallback from './http/errorsCallback.mjs';
8
+ import http_base from './http/HTTP-1.0.mjs';
9
+ import userIp from './http/userIP.mjs';
10
+ import convertBytes from './libs/convertBytes.mjs';
11
+ import custom_module_manager from './libs/custom_module_loader.mjs';
12
+ import replaceAsync from './libs/replaceAsync.mjs';
13
+ import * as momentjs from './momentjs/index.mjs';
14
+ import * as crypto from './crypto/index.mjs';
15
+ import pagination from './get/pagination.mjs';
16
+ import getDomainURL from './http/getDomainURL.mjs';
17
+ import tinyDice from './libs/dice.mjs';
18
+ import LevelUp from './libs/userLevel.mjs';
19
+ import queryUrlByName from './get/queryUrlByName.mjs';
20
+ import queryUrlJSON from './get/queryUrlJSON.mjs';
21
+ import decimalColor from './get/decimalColor.mjs';
22
+ import percentageBase from './libs/percentage.mjs';
23
+ import rule3 from './libs/rule3.mjs';
24
+ import versionCheck from './get/versionCheck.mjs';
25
+ import socketIo from './socket.io/index.mjs';
26
+ import arraySortPositions from './libs/arraySortPositions.mjs';
27
+ import capitalize from './libs/capitalize.mjs';
28
+ import getJsonFetch from './http/fetch/json.mjs';
29
+ import getTextFetch from './http/fetch/text.mjs';
30
+ import csrfTokenAnalyze from './http/csrfTokenAnalyze.mjs';
31
+ const legacyModules = {
32
+ // Convert Bytes
33
+ convertBytes,
34
+ // HTTP/1.0 Render
35
+ 'HTTP/1.0': http_base,
36
+ // Moment JS
37
+ momentjs,
38
+ // Check Domain
39
+ checkDomain: check_domain,
40
+ // Get Obj Type
41
+ getObjType: objType,
42
+ // Count Obj
43
+ countObj: countObj,
44
+ // HTTP Auth Generator
45
+ httpAuth: auth,
46
+ // Replace Async
47
+ replaceAsync,
48
+ // User IP
49
+ getUserIP: userIp,
50
+ // Super string Filter
51
+ superStringFilter: super_string_filter,
52
+ // Custom Module Loader
53
+ customModuleManager: custom_module_manager,
54
+ // Errors Callback
55
+ errorsCallback,
56
+ // Domain Validator
57
+ domainValidator,
58
+ // Crypto
59
+ crypto,
60
+ // Pagination
61
+ pagination,
62
+ // Get Domain URL
63
+ getDomainURL,
64
+ // Dice
65
+ dice: tinyDice,
66
+ // User Level
67
+ LevelUp: LevelUp,
68
+ // Get URL Parameter
69
+ getQueryUrlByName: queryUrlByName,
70
+ getQueryUrlJSON: queryUrlJSON,
71
+ // Get Decimal Color
72
+ getDecimalColor: decimalColor,
73
+ // Percentage
74
+ percentage: percentageBase,
75
+ // Rule 3
76
+ rule3,
77
+ // Version Check
78
+ versionCheck,
79
+ // Socket IO
80
+ socketIO: socketIo,
81
+ // Array Sort Positions
82
+ arraySortPositions,
83
+ // Capitalize
84
+ capitalize,
85
+ // Fetch
86
+ fetchJSON: getJsonFetch,
87
+ fetchText: getTextFetch,
88
+ // csrfToken Analyze
89
+ csrfTokenAnalyze,
90
+ };
91
+ // Modules
92
+ export default legacyModules;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Generates a comparator function to sort an array of objects by a given key.
5
+ *
6
+ * @param {string} item - The object key to sort by.
7
+ * @param {boolean} [isReverse=false] - If `true`, the sorting will be in descending order.
8
+ * @returns {(a: Object, b: Object) => number} Comparator function compatible with Array.prototype.sort().
9
+ *
10
+ * @example
11
+ * const arr = [{ pos: 2 }, { pos: 1 }, { pos: 3 }];
12
+ * arr.sort(arraySortPositions('pos')); // Ascending: [{pos: 1}, {pos: 2}, {pos: 3}]
13
+ *
14
+ * @example
15
+ * const arr = [{ pos: 2 }, { pos: 1 }, { pos: 3 }];
16
+ * arr.sort(arraySortPositions('pos', true)); // Descending: [{pos: 3}, {pos: 2}, {pos: 1}]
17
+ */
18
+ function arraySortPositions(item, isReverse = false) {
19
+ if (!isReverse) {
20
+ return function (a, b) {
21
+ return a[item] < b[item] ? -1 : a[item] > b[item] ? 1 : 0;
22
+ };
23
+ } else {
24
+ return function (a, b) {
25
+ return a[item] > b[item] ? -1 : a[item] < b[item] ? 1 : 0;
26
+ };
27
+ }
28
+ }
29
+
30
+ module.exports = arraySortPositions;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Generates a comparator function to sort an array of objects by a given key.
3
+ *
4
+ * @param {string} item - The object key to sort by.
5
+ * @param {boolean} [isReverse=false] - If `true`, the sorting will be in descending order.
6
+ * @returns {(a: Object, b: Object) => number} Comparator function compatible with Array.prototype.sort().
7
+ *
8
+ * @example
9
+ * const arr = [{ pos: 2 }, { pos: 1 }, { pos: 3 }];
10
+ * arr.sort(arraySortPositions('pos')); // Ascending: [{pos: 1}, {pos: 2}, {pos: 3}]
11
+ *
12
+ * @example
13
+ * const arr = [{ pos: 2 }, { pos: 1 }, { pos: 3 }];
14
+ * arr.sort(arraySortPositions('pos', true)); // Descending: [{pos: 3}, {pos: 2}, {pos: 1}]
15
+ */
16
+ export default function arraySortPositions(item: string, isReverse?: boolean): (a: Object, b: Object) => number;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Generates a comparator function to sort an array of objects by a given key.
3
+ *
4
+ * @param {string} item - The object key to sort by.
5
+ * @param {boolean} [isReverse=false] - If `true`, the sorting will be in descending order.
6
+ * @returns {(a: Object, b: Object) => number} Comparator function compatible with Array.prototype.sort().
7
+ *
8
+ * @example
9
+ * const arr = [{ pos: 2 }, { pos: 1 }, { pos: 3 }];
10
+ * arr.sort(arraySortPositions('pos')); // Ascending: [{pos: 1}, {pos: 2}, {pos: 3}]
11
+ *
12
+ * @example
13
+ * const arr = [{ pos: 2 }, { pos: 1 }, { pos: 3 }];
14
+ * arr.sort(arraySortPositions('pos', true)); // Descending: [{pos: 3}, {pos: 2}, {pos: 1}]
15
+ */
16
+ export default function arraySortPositions(item, isReverse = false) {
17
+ if (!isReverse) {
18
+ return function (a, b) {
19
+ return a[item] < b[item] ? -1 : a[item] > b[item] ? 1 : 0;
20
+ };
21
+ }
22
+ else {
23
+ return function (a, b) {
24
+ return a[item] > b[item] ? -1 : a[item] < b[item] ? 1 : 0;
25
+ };
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Capitalizes the first letter of each word in a given string.
5
+ *
6
+ * @param {string} text - The input string to be transformed.
7
+ * @returns {string} The transformed string with each word's first letter capitalized.
8
+ *
9
+ * @example
10
+ * capitalize("hello world"); // "Hello World"
11
+ *
12
+ * @example
13
+ * capitalize("my little pony"); // "My Little Pony"
14
+ */
15
+ function capitalize(text) {
16
+ return text.replace(/\b\w/g, function (l) {
17
+ return l.toUpperCase();
18
+ });
19
+ }
20
+
21
+ module.exports = capitalize;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Capitalizes the first letter of each word in a given string.
3
+ *
4
+ * @param {string} text - The input string to be transformed.
5
+ * @returns {string} The transformed string with each word's first letter capitalized.
6
+ *
7
+ * @example
8
+ * capitalize("hello world"); // "Hello World"
9
+ *
10
+ * @example
11
+ * capitalize("my little pony"); // "My Little Pony"
12
+ */
13
+ export default function capitalize(text: string): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Capitalizes the first letter of each word in a given string.
3
+ *
4
+ * @param {string} text - The input string to be transformed.
5
+ * @returns {string} The transformed string with each word's first letter capitalized.
6
+ *
7
+ * @example
8
+ * capitalize("hello world"); // "Hello World"
9
+ *
10
+ * @example
11
+ * capitalize("my little pony"); // "My Little Pony"
12
+ */
13
+ export default function capitalize(text) {
14
+ return text.replace(/\b\w/g, function (l) {
15
+ return l.toUpperCase();
16
+ });
17
+ }
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * A utility module to convert between bytes and higher order units (KB, MB, GB, etc).
5
+ */
6
+
7
+ /**
8
+ * @typedef {'kb'|'mb'|'gb'|'tb'|'pb'|'eb'} SizeUnit
9
+ */
10
+ const convertList = {
11
+ kb: 1024,
12
+ mb: 1048576,
13
+ gb: 1073741824,
14
+ tb: 1099511627776,
15
+ pb: 1125899906842624,
16
+ eb: 1152921504606847000,
17
+ };
18
+
19
+ const sequence = ['kb', 'mb', 'gb', 'tb', 'pb', 'eb'];
20
+
21
+ /**
22
+ * @namespace convertBytes
23
+ */
24
+ const convertBytes = {
25
+ /**
26
+ * Conversion factors for each unit.
27
+ * @type {Object.<SizeUnit, number>}
28
+ */
29
+ list: convertList,
30
+
31
+ /**
32
+ * Ordered list of size units.
33
+ * @type {SizeUnit[]}
34
+ */
35
+ sequence: sequence,
36
+
37
+ /**
38
+ * Converts a size in the specified unit to bytes.
39
+ * @param {number} bytes - The number of units to convert.
40
+ * @param {SizeUnit} selected - The unit of the input value.
41
+ * @returns {number} The equivalent size in bytes.
42
+ *
43
+ * @example
44
+ * convertBytes.get(5, 'mb'); // 5242880
45
+ */
46
+ get: function (bytes, selected) {
47
+ return convertList[selected] * bytes;
48
+ },
49
+
50
+ /**
51
+ * Converts a size in bytes to the specified unit.
52
+ * @param {number} bytes - The size in bytes.
53
+ * @param {SizeUnit} selected - The target unit.
54
+ * @returns {number} The equivalent size in the selected unit.
55
+ *
56
+ * @example
57
+ * convertBytes.convert(1048576, 'mb'); // 1
58
+ */
59
+ convert: function (bytes, selected) {
60
+ return bytes / convertList[selected];
61
+ },
62
+ };
63
+
64
+ module.exports = convertBytes;
@@ -0,0 +1,17 @@
1
+ export default convertBytes;
2
+ export type SizeUnit = "kb" | "mb" | "gb" | "tb" | "pb" | "eb";
3
+ declare namespace convertBytes {
4
+ export { convertList as list };
5
+ export { sequence };
6
+ export function get(bytes: number, selected: SizeUnit): number;
7
+ export function convert(bytes: number, selected: SizeUnit): number;
8
+ }
9
+ declare namespace convertList {
10
+ let kb: number;
11
+ let mb: number;
12
+ let gb: number;
13
+ let tb: number;
14
+ let pb: number;
15
+ let eb: number;
16
+ }
17
+ declare const sequence: string[];
@@ -0,0 +1,55 @@
1
+ /**
2
+ * A utility module to convert between bytes and higher order units (KB, MB, GB, etc).
3
+ */
4
+ /**
5
+ * @typedef {'kb'|'mb'|'gb'|'tb'|'pb'|'eb'} SizeUnit
6
+ */
7
+ const convertList = {
8
+ kb: 1024,
9
+ mb: 1048576,
10
+ gb: 1073741824,
11
+ tb: 1099511627776,
12
+ pb: 1125899906842624,
13
+ eb: 1152921504606847000,
14
+ };
15
+ const sequence = ['kb', 'mb', 'gb', 'tb', 'pb', 'eb'];
16
+ /**
17
+ * @namespace convertBytes
18
+ */
19
+ const convertBytes = {
20
+ /**
21
+ * Conversion factors for each unit.
22
+ * @type {Object.<SizeUnit, number>}
23
+ */
24
+ list: convertList,
25
+ /**
26
+ * Ordered list of size units.
27
+ * @type {SizeUnit[]}
28
+ */
29
+ sequence: sequence,
30
+ /**
31
+ * Converts a size in the specified unit to bytes.
32
+ * @param {number} bytes - The number of units to convert.
33
+ * @param {SizeUnit} selected - The unit of the input value.
34
+ * @returns {number} The equivalent size in bytes.
35
+ *
36
+ * @example
37
+ * convertBytes.get(5, 'mb'); // 5242880
38
+ */
39
+ get: function (bytes, selected) {
40
+ return convertList[selected] * bytes;
41
+ },
42
+ /**
43
+ * Converts a size in bytes to the specified unit.
44
+ * @param {number} bytes - The size in bytes.
45
+ * @param {SizeUnit} selected - The target unit.
46
+ * @returns {number} The equivalent size in the selected unit.
47
+ *
48
+ * @example
49
+ * convertBytes.convert(1048576, 'mb'); // 1
50
+ */
51
+ convert: function (bytes, selected) {
52
+ return bytes / convertList[selected];
53
+ },
54
+ };
55
+ export default convertBytes;
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ var objType = require('../get/objType.cjs');
4
+
5
+ /**
6
+ * A custom module manager to validate and run hooks on external modules dynamically.
7
+ * Especially useful for plugin-like systems or hooks in systems like payment handlers.
8
+ * @namespace custom_module_manager
9
+ */
10
+ const custom_module_manager = {
11
+ /**
12
+ * Validates if the given object has valid custom or default module arrays.
13
+ * @param {Object} custom_modules - The object containing module definitions.
14
+ * @param {string} type - The specific type of module to validate.
15
+ * @returns {boolean} Whether the module is valid.
16
+ *
17
+ * @example
18
+ * custom_module_manager.validator(myModules, 'paypal'); // true or false
19
+ */
20
+ validator: function (custom_modules, type) {
21
+ if (
22
+ custom_modules &&
23
+ custom_modules[type] &&
24
+ (Array.isArray(custom_modules[type].custom) || Array.isArray(custom_modules[type].default))
25
+ )
26
+ return true;
27
+ else return false;
28
+ },
29
+
30
+ /**
31
+ * Executes all functions inside the given modules.
32
+ * Accepts either an array of functions or an object with typed module arrays.
33
+ *
34
+ * @param {Object|Function[]} custom_modules - The modules or functions to run.
35
+ * @param {*} db_prepare - A value to pass to each module when called.
36
+ * @param {string} hookType - A string representing the hook (e.g., 'before', 'after').
37
+ * @param {Object} [options] - Optional. Object with keys matching types in `custom_modules`.
38
+ *
39
+ * @returns {Promise<void>}
40
+ *
41
+ * @example
42
+ * await custom_module_manager.run(customModules, db, 'after', { paypal: true });
43
+ */
44
+ run: async function (custom_modules, db_prepare, hookType, options) {
45
+ const run_custom_module = async function (type) {
46
+ let module_list = null;
47
+
48
+ if (type) {
49
+ if (custom_modules && custom_modules[type]) module_list = custom_modules[type];
50
+ } else module_list = custom_modules;
51
+
52
+ if (Array.isArray(module_list)) {
53
+ for (const item in module_list) {
54
+ if (typeof module_list[item] === 'function') {
55
+ try {
56
+ await module_list[item](db_prepare, hookType);
57
+ } catch (err) {
58
+ console.error(err);
59
+ console.error(err.message);
60
+ }
61
+ } else {
62
+ const err = new Error(
63
+ `The Custom Paypal Module value needs to be a Function!\nArray: ${type}\nIndex: ${item}`,
64
+ );
65
+ console.error(err);
66
+ console.error(err.message);
67
+ }
68
+ }
69
+ }
70
+ };
71
+
72
+ if (objType(options, 'object')) {
73
+ for (const item in options) {
74
+ if (options[item] && Array.isArray(custom_modules[item])) await run_custom_module(item);
75
+ }
76
+ } else {
77
+ if (Array.isArray(custom_modules)) await run_custom_module();
78
+ }
79
+ },
80
+ };
81
+
82
+ module.exports = custom_module_manager;
@@ -0,0 +1,5 @@
1
+ export default custom_module_manager;
2
+ declare namespace custom_module_manager {
3
+ function validator(custom_modules: Object, type: string): boolean;
4
+ function run(custom_modules: Object | Function[], db_prepare: any, hookType: string, options?: Object): Promise<void>;
5
+ }
@@ -0,0 +1,79 @@
1
+ import objType from '../get/objType.mjs';
2
+ /**
3
+ * A custom module manager to validate and run hooks on external modules dynamically.
4
+ * Especially useful for plugin-like systems or hooks in systems like payment handlers.
5
+ * @namespace custom_module_manager
6
+ */
7
+ const custom_module_manager = {
8
+ /**
9
+ * Validates if the given object has valid custom or default module arrays.
10
+ * @param {Object} custom_modules - The object containing module definitions.
11
+ * @param {string} type - The specific type of module to validate.
12
+ * @returns {boolean} Whether the module is valid.
13
+ *
14
+ * @example
15
+ * custom_module_manager.validator(myModules, 'paypal'); // true or false
16
+ */
17
+ validator: function (custom_modules, type) {
18
+ if (custom_modules &&
19
+ custom_modules[type] &&
20
+ (Array.isArray(custom_modules[type].custom) || Array.isArray(custom_modules[type].default)))
21
+ return true;
22
+ else
23
+ return false;
24
+ },
25
+ /**
26
+ * Executes all functions inside the given modules.
27
+ * Accepts either an array of functions or an object with typed module arrays.
28
+ *
29
+ * @param {Object|Function[]} custom_modules - The modules or functions to run.
30
+ * @param {*} db_prepare - A value to pass to each module when called.
31
+ * @param {string} hookType - A string representing the hook (e.g., 'before', 'after').
32
+ * @param {Object} [options] - Optional. Object with keys matching types in `custom_modules`.
33
+ *
34
+ * @returns {Promise<void>}
35
+ *
36
+ * @example
37
+ * await custom_module_manager.run(customModules, db, 'after', { paypal: true });
38
+ */
39
+ run: async function (custom_modules, db_prepare, hookType, options) {
40
+ const run_custom_module = async function (type) {
41
+ let module_list = null;
42
+ if (type) {
43
+ if (custom_modules && custom_modules[type])
44
+ module_list = custom_modules[type];
45
+ }
46
+ else
47
+ module_list = custom_modules;
48
+ if (Array.isArray(module_list)) {
49
+ for (const item in module_list) {
50
+ if (typeof module_list[item] === 'function') {
51
+ try {
52
+ await module_list[item](db_prepare, hookType);
53
+ }
54
+ catch (err) {
55
+ console.error(err);
56
+ console.error(err.message);
57
+ }
58
+ }
59
+ else {
60
+ const err = new Error(`The Custom Paypal Module value needs to be a Function!\nArray: ${type}\nIndex: ${item}`);
61
+ console.error(err);
62
+ console.error(err.message);
63
+ }
64
+ }
65
+ }
66
+ };
67
+ if (objType(options, 'object')) {
68
+ for (const item in options) {
69
+ if (options[item] && Array.isArray(custom_modules[item]))
70
+ await run_custom_module(item);
71
+ }
72
+ }
73
+ else {
74
+ if (Array.isArray(custom_modules))
75
+ await run_custom_module();
76
+ }
77
+ },
78
+ };
79
+ export default custom_module_manager;
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * A simple random number generator (dice roller) utility.
5
+ * Supports a vanilla dice roll from 1 to N.
6
+ * @namespace tinyDice
7
+ */
8
+ const tinyDice = {
9
+ /**
10
+ * Generates a random integer between 1 and `obj`, inclusive.
11
+ * @param {number} obj - The maximum value of the dice.
12
+ * @returns {number} The result of the dice roll.
13
+ *
14
+ * @example
15
+ * const result = tinyDice.vanilla(6); // 1 to 6
16
+ */
17
+ vanilla: function (obj) {
18
+ return Number(Math.floor(Math.random() * (obj - 1 + 1) + 1));
19
+ },
20
+
21
+ /**
22
+ * Returns the stringified version of the `vanilla()` method.
23
+ * Useful for injecting the dice logic in client environments.
24
+ * @param {number} obj - Unused in the function body.
25
+ * @returns {string} The function source code of `vanilla`.
26
+ *
27
+ * @example
28
+ * const clientScript = tinyDice.getClientVanilla();
29
+ */
30
+ getClientVanilla: function (obj) {
31
+ return tinyDice.vanilla.toString();
32
+ },
33
+ };
34
+
35
+ module.exports = tinyDice;
@@ -0,0 +1,5 @@
1
+ export default tinyDice;
2
+ declare namespace tinyDice {
3
+ function vanilla(obj: number): number;
4
+ function getClientVanilla(obj: number): string;
5
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A simple random number generator (dice roller) utility.
3
+ * Supports a vanilla dice roll from 1 to N.
4
+ * @namespace tinyDice
5
+ */
6
+ const tinyDice = {
7
+ /**
8
+ * Generates a random integer between 1 and `obj`, inclusive.
9
+ * @param {number} obj - The maximum value of the dice.
10
+ * @returns {number} The result of the dice roll.
11
+ *
12
+ * @example
13
+ * const result = tinyDice.vanilla(6); // 1 to 6
14
+ */
15
+ vanilla: function (obj) {
16
+ return Number(Math.floor(Math.random() * (obj - 1 + 1) + 1));
17
+ },
18
+ /**
19
+ * Returns the stringified version of the `vanilla()` method.
20
+ * Useful for injecting the dice logic in client environments.
21
+ * @param {number} obj - Unused in the function body.
22
+ * @returns {string} The function source code of `vanilla`.
23
+ *
24
+ * @example
25
+ * const clientScript = tinyDice.getClientVanilla();
26
+ */
27
+ getClientVanilla: function (obj) {
28
+ return tinyDice.vanilla.toString();
29
+ },
30
+ };
31
+ export default tinyDice;