@futdevpro/fsm-dynamo 1.10.37 → 1.10.39

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 (290) hide show
  1. package/.github/workflows/main.yml +11 -51
  2. package/build/_collections/constants/error-defaults.const.d.ts +8 -0
  3. package/build/_collections/constants/error-defaults.const.d.ts.map +1 -1
  4. package/build/_collections/constants/error-defaults.const.js +8 -0
  5. package/build/_collections/constants/error-defaults.const.js.map +1 -1
  6. package/build/_collections/constants/global-settings.const.d.ts +8 -0
  7. package/build/_collections/constants/global-settings.const.d.ts.map +1 -1
  8. package/build/_collections/constants/global-settings.const.js +9 -0
  9. package/build/_collections/constants/global-settings.const.js.map +1 -1
  10. package/build/_collections/constants/numbers.const.d.ts +32 -0
  11. package/build/_collections/constants/numbers.const.d.ts.map +1 -1
  12. package/build/_collections/constants/numbers.const.js +32 -0
  13. package/build/_collections/constants/numbers.const.js.map +1 -1
  14. package/build/_collections/constants/times.const.d.ts +31 -0
  15. package/build/_collections/constants/times.const.d.ts.map +1 -1
  16. package/build/_collections/constants/times.const.js +31 -0
  17. package/build/_collections/constants/times.const.js.map +1 -1
  18. package/build/_collections/utils/array.util.d.ts +136 -7
  19. package/build/_collections/utils/array.util.d.ts.map +1 -1
  20. package/build/_collections/utils/array.util.js +132 -2
  21. package/build/_collections/utils/array.util.js.map +1 -1
  22. package/build/_collections/utils/array.util.spec.js.map +1 -1
  23. package/build/_collections/utils/log.util.d.ts +123 -0
  24. package/build/_collections/utils/log.util.d.ts.map +1 -1
  25. package/build/_collections/utils/log.util.js +123 -0
  26. package/build/_collections/utils/log.util.js.map +1 -1
  27. package/build/_collections/utils/math/box-bounds.spec.js +2 -5
  28. package/build/_collections/utils/math/box-bounds.spec.js.map +1 -1
  29. package/build/_collections/utils/math/box-bounds.util.d.ts +52 -6
  30. package/build/_collections/utils/math/box-bounds.util.d.ts.map +1 -1
  31. package/build/_collections/utils/math/box-bounds.util.js +57 -5
  32. package/build/_collections/utils/math/box-bounds.util.js.map +1 -1
  33. package/build/_collections/utils/math/box-bounds.util.spec.js +1 -1
  34. package/build/_collections/utils/math/box-bounds.util.spec.js.map +1 -1
  35. package/build/_collections/utils/math/math.util.d.ts +30 -0
  36. package/build/_collections/utils/math/math.util.d.ts.map +1 -1
  37. package/build/_collections/utils/math/math.util.js +30 -0
  38. package/build/_collections/utils/math/math.util.js.map +1 -1
  39. package/build/_collections/utils/math/random.util.d.ts +19 -2
  40. package/build/_collections/utils/math/random.util.d.ts.map +1 -1
  41. package/build/_collections/utils/math/random.util.js +22 -0
  42. package/build/_collections/utils/math/random.util.js.map +1 -1
  43. package/build/_collections/utils/math/random.util.spec.js.map +1 -1
  44. package/build/_collections/utils/math/vector2.util.d.ts +142 -20
  45. package/build/_collections/utils/math/vector2.util.d.ts.map +1 -1
  46. package/build/_collections/utils/math/vector2.util.js +126 -0
  47. package/build/_collections/utils/math/vector2.util.js.map +1 -1
  48. package/build/_collections/utils/round-list.util.d.ts +36 -1
  49. package/build/_collections/utils/round-list.util.d.ts.map +1 -1
  50. package/build/_collections/utils/round-list.util.js +35 -0
  51. package/build/_collections/utils/round-list.util.js.map +1 -1
  52. package/build/_collections/utils/shared.util.js.map +1 -1
  53. package/build/_collections/utils/stack.util.js +3 -3
  54. package/build/_collections/utils/stack.util.js.map +1 -1
  55. package/build/_collections/utils/string.util.d.ts +8 -1
  56. package/build/_collections/utils/string.util.d.ts.map +1 -1
  57. package/build/_collections/utils/string.util.js +8 -1
  58. package/build/_collections/utils/string.util.js.map +1 -1
  59. package/build/_collections/utils/time.util.d.ts +29 -0
  60. package/build/_collections/utils/time.util.d.ts.map +1 -1
  61. package/build/_collections/utils/time.util.js +29 -0
  62. package/build/_collections/utils/time.util.js.map +1 -1
  63. package/build/_collections/utils/type-cloning-facility.util.d.ts +29 -3
  64. package/build/_collections/utils/type-cloning-facility.util.d.ts.map +1 -1
  65. package/build/_collections/utils/type-cloning-facility.util.js +53 -3
  66. package/build/_collections/utils/type-cloning-facility.util.js.map +1 -1
  67. package/build/_collections/utils/utilities.util.d.ts +49 -2
  68. package/build/_collections/utils/utilities.util.d.ts.map +1 -1
  69. package/build/_collections/utils/utilities.util.js +53 -1
  70. package/build/_collections/utils/utilities.util.js.map +1 -1
  71. package/build/_collections/utils/utilities.util.spec.js.map +1 -1
  72. package/build/_collections/utils/uuid.util.d.ts +5 -0
  73. package/build/_collections/utils/uuid.util.d.ts.map +1 -1
  74. package/build/_collections/utils/uuid.util.js +5 -0
  75. package/build/_collections/utils/uuid.util.js.map +1 -1
  76. package/build/_enums/basic-property-type.enum.d.ts +8 -0
  77. package/build/_enums/basic-property-type.enum.d.ts.map +1 -1
  78. package/build/_enums/basic-property-type.enum.js +8 -0
  79. package/build/_enums/basic-property-type.enum.js.map +1 -1
  80. package/build/_enums/data-model-type.enum.d.ts +8 -4
  81. package/build/_enums/data-model-type.enum.d.ts.map +1 -1
  82. package/build/_enums/data-model-type.enum.js +8 -4
  83. package/build/_enums/data-model-type.enum.js.map +1 -1
  84. package/build/_enums/environment-flag.enum.d.ts +18 -0
  85. package/build/_enums/environment-flag.enum.d.ts.map +1 -1
  86. package/build/_enums/environment-flag.enum.js +18 -0
  87. package/build/_enums/environment-flag.enum.js.map +1 -1
  88. package/build/_enums/error-level.enum.d.ts +10 -0
  89. package/build/_enums/error-level.enum.d.ts.map +1 -1
  90. package/build/_enums/error-level.enum.js +10 -0
  91. package/build/_enums/error-level.enum.js.map +1 -1
  92. package/build/_enums/http-call-type.enum.d.ts +6 -2
  93. package/build/_enums/http-call-type.enum.d.ts.map +1 -1
  94. package/build/_enums/http-call-type.enum.js +6 -2
  95. package/build/_enums/http-call-type.enum.js.map +1 -1
  96. package/build/_enums/http-response-type.enum.d.ts +8 -0
  97. package/build/_enums/http-response-type.enum.d.ts.map +1 -1
  98. package/build/_enums/http-response-type.enum.js +8 -0
  99. package/build/_enums/http-response-type.enum.js.map +1 -1
  100. package/build/_enums/log-style.enum.d.ts +8 -0
  101. package/build/_enums/log-style.enum.d.ts.map +1 -1
  102. package/build/_enums/log-style.enum.js +8 -0
  103. package/build/_enums/log-style.enum.js.map +1 -1
  104. package/build/_enums/time/day-of-week.enum.d.ts +13 -1
  105. package/build/_enums/time/day-of-week.enum.d.ts.map +1 -1
  106. package/build/_enums/time/day-of-week.enum.js +13 -1
  107. package/build/_enums/time/day-of-week.enum.js.map +1 -1
  108. package/build/_enums/time/month.enum.d.ts +8 -0
  109. package/build/_enums/time/month.enum.d.ts.map +1 -1
  110. package/build/_enums/time/month.enum.js +8 -0
  111. package/build/_enums/time/month.enum.js.map +1 -1
  112. package/build/_enums/time/relative-date.enum.d.ts +10 -0
  113. package/build/_enums/time/relative-date.enum.d.ts.map +1 -1
  114. package/build/_enums/time/relative-date.enum.js +10 -0
  115. package/build/_enums/time/relative-date.enum.js.map +1 -1
  116. package/build/_models/control-models/data-model-params.control-model.d.ts +4 -4
  117. package/build/_models/control-models/data-model-params.control-model.d.ts.map +1 -1
  118. package/build/_models/control-models/data-model-params.control-model.js.map +1 -1
  119. package/build/_models/control-models/data-property-params.control-model.d.ts.map +1 -1
  120. package/build/_models/control-models/data-property-params.control-model.js.map +1 -1
  121. package/build/_models/control-models/error.control-model.spec.js.map +1 -1
  122. package/build/_models/interfaces/box-bounds.interface.d.ts +8 -0
  123. package/build/_models/interfaces/box-bounds.interface.d.ts.map +1 -0
  124. package/build/_models/interfaces/box-bounds.interface.js +3 -0
  125. package/build/_models/interfaces/box-bounds.interface.js.map +1 -0
  126. package/build/_models/interfaces/environment/global-settings.interface.d.ts +1 -0
  127. package/build/_models/interfaces/environment/global-settings.interface.d.ts.map +1 -1
  128. package/build/_models/interfaces/route-settings.interface.d.ts +6 -1
  129. package/build/_models/interfaces/route-settings.interface.d.ts.map +1 -1
  130. package/build/_modules/crypto/_collections/crypto.util.d.ts +11 -17
  131. package/build/_modules/crypto/_collections/crypto.util.d.ts.map +1 -1
  132. package/build/_modules/crypto/_collections/crypto.util.js +74 -58
  133. package/build/_modules/crypto/_collections/crypto.util.js.map +1 -1
  134. package/build/_modules/crypto/_collections/crypto.util.spec.js +390 -0
  135. package/build/_modules/crypto/_collections/crypto.util.spec.js.map +1 -1
  136. package/build/_modules/custom-data/_collections/cud-module-settings.const.d.ts +6 -0
  137. package/build/_modules/custom-data/_collections/cud-module-settings.const.d.ts.map +1 -1
  138. package/build/_modules/custom-data/_collections/cud-module-settings.const.js +6 -0
  139. package/build/_modules/custom-data/_collections/cud-module-settings.const.js.map +1 -1
  140. package/build/_modules/custom-data/_models/cud.data-model.d.ts +3 -0
  141. package/build/_modules/custom-data/_models/cud.data-model.d.ts.map +1 -1
  142. package/build/_modules/custom-data/_models/cud.data-model.js +3 -0
  143. package/build/_modules/custom-data/_models/cud.data-model.js.map +1 -1
  144. package/build/_modules/location/_collections/loc-country-divisions.const.d.ts +1 -0
  145. package/build/_modules/location/_collections/loc-country-divisions.const.d.ts.map +1 -1
  146. package/build/_modules/location/_collections/loc-country-divisions.const.js +1 -0
  147. package/build/_modules/location/_collections/loc-country-divisions.const.js.map +1 -1
  148. package/build/_modules/location/_collections/loc-regions.util.d.ts +4 -0
  149. package/build/_modules/location/_collections/loc-regions.util.d.ts.map +1 -1
  150. package/build/_modules/location/_collections/loc-regions.util.js +4 -0
  151. package/build/_modules/location/_collections/loc-regions.util.js.map +1 -1
  152. package/build/_modules/location/_collections/loc.util.d.ts +9 -0
  153. package/build/_modules/location/_collections/loc.util.d.ts.map +1 -1
  154. package/build/_modules/location/_collections/loc.util.js +9 -0
  155. package/build/_modules/location/_collections/loc.util.js.map +1 -1
  156. package/build/_modules/location/_enums/loc-region.enum.d.ts +3 -0
  157. package/build/_modules/location/_enums/loc-region.enum.d.ts.map +1 -1
  158. package/build/_modules/location/_enums/loc-region.enum.js +3 -0
  159. package/build/_modules/location/_enums/loc-region.enum.js.map +1 -1
  160. package/build/_modules/location/_enums/loc-sub-region.enum.d.ts +3 -0
  161. package/build/_modules/location/_enums/loc-sub-region.enum.d.ts.map +1 -1
  162. package/build/_modules/location/_enums/loc-sub-region.enum.js +3 -0
  163. package/build/_modules/location/_enums/loc-sub-region.enum.js.map +1 -1
  164. package/build/_modules/location/_enums/loc-subdivision-region-type.enum.d.ts +37 -34
  165. package/build/_modules/location/_enums/loc-subdivision-region-type.enum.d.ts.map +1 -1
  166. package/build/_modules/location/_enums/loc-subdivision-region-type.enum.js +3 -0
  167. package/build/_modules/location/_enums/loc-subdivision-region-type.enum.js.map +1 -1
  168. package/build/_modules/location/_models/loc-coordinates.interface.d.ts +1 -0
  169. package/build/_modules/location/_models/loc-coordinates.interface.d.ts.map +1 -1
  170. package/build/_modules/open-ai/_enums/open-ai-model.enum.d.ts +10 -7
  171. package/build/_modules/open-ai/_enums/open-ai-model.enum.d.ts.map +1 -1
  172. package/build/_modules/open-ai/_enums/open-ai-model.enum.js +3 -0
  173. package/build/_modules/open-ai/_enums/open-ai-model.enum.js.map +1 -1
  174. package/build/_modules/pipe/_enums/pip-range-pipe-setting.enum.d.ts +3 -0
  175. package/build/_modules/pipe/_enums/pip-range-pipe-setting.enum.d.ts.map +1 -1
  176. package/build/_modules/pipe/_enums/pip-range-pipe-setting.enum.js +3 -0
  177. package/build/_modules/pipe/_enums/pip-range-pipe-setting.enum.js.map +1 -1
  178. package/build/_modules/pipe/_enums/pip.enum.d.ts +14 -0
  179. package/build/_modules/pipe/_enums/pip.enum.d.ts.map +1 -1
  180. package/build/_modules/pipe/_enums/pip.enum.js +11 -0
  181. package/build/_modules/pipe/_enums/pip.enum.js.map +1 -1
  182. package/build/_modules/socket/_enums/sck-event-key.enum.d.ts +3 -0
  183. package/build/_modules/socket/_enums/sck-event-key.enum.d.ts.map +1 -1
  184. package/build/_modules/socket/_enums/sck-event-key.enum.js +3 -0
  185. package/build/_modules/socket/_enums/sck-event-key.enum.js.map +1 -1
  186. package/build/_modules/socket/_models/sck-client-params.control-model.d.ts +12 -0
  187. package/build/_modules/socket/_models/sck-client-params.control-model.d.ts.map +1 -1
  188. package/build/_modules/socket/_models/sck-client-params.control-model.js +12 -0
  189. package/build/_modules/socket/_models/sck-client-params.control-model.js.map +1 -1
  190. package/build/_modules/socket/_models/sck-socket-event.control-model.d.ts +12 -1
  191. package/build/_modules/socket/_models/sck-socket-event.control-model.d.ts.map +1 -1
  192. package/build/_modules/socket/_models/sck-socket-event.control-model.js +12 -1
  193. package/build/_modules/socket/_models/sck-socket-event.control-model.js.map +1 -1
  194. package/build/_modules/socket/_services/sck-client.service-base.d.ts +4 -0
  195. package/build/_modules/socket/_services/sck-client.service-base.d.ts.map +1 -1
  196. package/build/_modules/socket/_services/sck-client.service-base.js +4 -0
  197. package/build/_modules/socket/_services/sck-client.service-base.js.map +1 -1
  198. package/build/_modules/test/_collections/tst-module-settings.const.d.ts +9 -0
  199. package/build/_modules/test/_collections/tst-module-settings.const.d.ts.map +1 -1
  200. package/build/_modules/test/_collections/tst-module-settings.const.js +9 -0
  201. package/build/_modules/test/_collections/tst-module-settings.const.js.map +1 -1
  202. package/build/_modules/usage/_models/usg-action.control-model.d.ts +13 -0
  203. package/build/_modules/usage/_models/usg-action.control-model.d.ts.map +1 -1
  204. package/build/_modules/usage/_models/usg-action.control-model.js +13 -0
  205. package/build/_modules/usage/_models/usg-action.control-model.js.map +1 -1
  206. package/build/_modules/usage/_models/usg-daily-usage-data.control-model.d.ts +14 -0
  207. package/build/_modules/usage/_models/usg-daily-usage-data.control-model.d.ts.map +1 -1
  208. package/build/_modules/usage/_models/usg-daily-usage-data.control-model.js +14 -0
  209. package/build/_modules/usage/_models/usg-daily-usage-data.control-model.js.map +1 -1
  210. package/build/_modules/usage/_models/usg-data.control-model.d.ts +16 -0
  211. package/build/_modules/usage/_models/usg-data.control-model.d.ts.map +1 -1
  212. package/build/_modules/usage/_models/usg-data.control-model.js +16 -0
  213. package/build/_modules/usage/_models/usg-data.control-model.js.map +1 -1
  214. package/build/_modules/usage/_models/usg-session.data-model.d.ts +17 -0
  215. package/build/_modules/usage/_models/usg-session.data-model.d.ts.map +1 -1
  216. package/build/_modules/usage/_models/usg-session.data-model.js +17 -0
  217. package/build/_modules/usage/_models/usg-session.data-model.js.map +1 -1
  218. package/build/_modules/usage/_models/usg-session.data-model.spec.js.map +1 -1
  219. package/build/index.d.ts +1 -0
  220. package/build/index.d.ts.map +1 -1
  221. package/build/index.js +1 -0
  222. package/build/index.js.map +1 -1
  223. package/futdevpro-fsm-dynamo-01.10.39.tgz +0 -0
  224. package/package.json +9 -5
  225. package/src/_collections/constants/error-defaults.const.ts +8 -0
  226. package/src/_collections/constants/global-settings.const.ts +12 -2
  227. package/src/_collections/constants/numbers.const.ts +32 -0
  228. package/src/_collections/constants/times.const.ts +37 -0
  229. package/src/_collections/utils/array.util.spec.ts +36 -38
  230. package/src/_collections/utils/array.util.ts +146 -12
  231. package/src/_collections/utils/log.util.ts +126 -2
  232. package/src/_collections/utils/math/box-bounds.spec.ts +8 -13
  233. package/src/_collections/utils/math/box-bounds.util.spec.ts +3 -3
  234. package/src/_collections/utils/math/box-bounds.util.ts +65 -12
  235. package/src/_collections/utils/math/math.util.ts +30 -6
  236. package/src/_collections/utils/math/random.util.spec.ts +7 -7
  237. package/src/_collections/utils/math/random.util.ts +27 -4
  238. package/src/_collections/utils/math/vector2.util.ts +148 -21
  239. package/src/_collections/utils/round-list.util.ts +36 -3
  240. package/src/_collections/utils/shared.util.ts +17 -17
  241. package/src/_collections/utils/stack.util.ts +6 -6
  242. package/src/_collections/utils/string.util.ts +8 -1
  243. package/src/_collections/utils/time.util.ts +37 -2
  244. package/src/_collections/utils/type-cloning-facility.util.ts +57 -8
  245. package/src/_collections/utils/utilities.util.spec.ts +2 -2
  246. package/src/_collections/utils/utilities.util.ts +61 -8
  247. package/src/_collections/utils/uuid.util.ts +5 -0
  248. package/src/_enums/basic-property-type.enum.ts +8 -0
  249. package/src/_enums/data-model-type.enum.ts +11 -6
  250. package/src/_enums/environment-flag.enum.ts +18 -0
  251. package/src/_enums/error-level.enum.ts +10 -0
  252. package/src/_enums/http-call-type.enum.ts +6 -2
  253. package/src/_enums/http-response-type.enum.ts +8 -0
  254. package/src/_enums/log-style.enum.ts +8 -0
  255. package/src/_enums/time/day-of-week.enum.ts +13 -1
  256. package/src/_enums/time/month.enum.ts +8 -0
  257. package/src/_enums/time/relative-date.enum.ts +10 -0
  258. package/src/_models/control-models/data-model-params.control-model.ts +6 -6
  259. package/src/_models/control-models/data-property-params.control-model.ts +1 -1
  260. package/src/_models/control-models/error.control-model.spec.ts +2 -2
  261. package/src/_models/interfaces/box-bounds.interface.ts +8 -0
  262. package/src/_models/interfaces/environment/global-settings.interface.ts +2 -0
  263. package/src/_models/interfaces/route-settings.interface.ts +6 -1
  264. package/src/_modules/crypto/_collections/crypto.util.spec.ts +428 -0
  265. package/src/_modules/crypto/_collections/crypto.util.ts +88 -52
  266. package/src/_modules/custom-data/_collections/cud-module-settings.const.ts +6 -0
  267. package/src/_modules/custom-data/_models/cud.data-model.ts +3 -0
  268. package/src/_modules/location/_collections/loc-country-divisions.const.ts +2 -1
  269. package/src/_modules/location/_collections/loc-regions.util.ts +4 -0
  270. package/src/_modules/location/_collections/loc.util.ts +13 -5
  271. package/src/_modules/location/_enums/loc-region.enum.ts +3 -0
  272. package/src/_modules/location/_enums/loc-sub-region.enum.ts +3 -0
  273. package/src/_modules/location/_enums/loc-subdivision-region-type.enum.ts +37 -34
  274. package/src/_modules/location/_models/loc-coordinates.interface.ts +1 -0
  275. package/src/_modules/open-ai/_enums/open-ai-model.enum.ts +11 -8
  276. package/src/_modules/pipe/_enums/pip-range-pipe-setting.enum.ts +3 -0
  277. package/src/_modules/pipe/_enums/pip.enum.ts +17 -3
  278. package/src/_modules/socket/_enums/sck-event-key.enum.ts +3 -0
  279. package/src/_modules/socket/_models/sck-client-params.control-model.ts +12 -0
  280. package/src/_modules/socket/_models/sck-socket-event.control-model.ts +12 -1
  281. package/src/_modules/socket/_services/sck-client.service-base.ts +4 -0
  282. package/src/_modules/test/_collections/tst-module-settings.const.ts +9 -0
  283. package/src/_modules/usage/_models/usg-action.control-model.ts +13 -0
  284. package/src/_modules/usage/_models/usg-daily-usage-data.control-model.ts +14 -0
  285. package/src/_modules/usage/_models/usg-data.control-model.ts +16 -0
  286. package/src/_modules/usage/_models/usg-session.data-model.spec.ts +2 -1
  287. package/src/_modules/usage/_models/usg-session.data-model.ts +17 -0
  288. package/src/index.ts +1 -0
  289. package/tsconfig.json +1 -0
  290. package/futdevpro-fsm-dynamo-01.10.37.tgz +0 -0
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  import { DyFM_Paged } from '../../_models/interfaces/paged.interface';
4
2
  import { DyFM_Array } from './array.util';
5
3
  import { DyFM_delay } from './utilities.util';
@@ -8,9 +6,9 @@ describe('| DyFM_Array', (): void => {
8
6
 
9
7
  describe('| asyncForEach', (): void => {
10
8
  it('| should call the function for each element in the list', async (): Promise<void> => {
11
- const list = [ 1, 2, 3 ];
12
- const result = [];
13
- const func = async (e, i): Promise<void> => {
9
+ const list: number[] = [ 1, 2, 3 ];
10
+ const result: number[] = [];
11
+ const func = async (e: number, i?: number): Promise<void> => {
14
12
  await DyFM_delay(30);
15
13
  result.push(e);
16
14
  };
@@ -23,9 +21,9 @@ describe('| DyFM_Array', (): void => {
23
21
 
24
22
  describe('| asyncMapArray', (): void => {
25
23
  it('| should call the function for each element in the list', async (): Promise<void> => {
26
- const list = [ 1, 2, 3 ];
24
+ const list: number[] = [ 1, 2, 3 ];
27
25
 
28
- const func = async (e, i): Promise<number> => {
26
+ const func = async (e: number, i?: number): Promise<number> => {
29
27
  await DyFM_delay(30);
30
28
 
31
29
  return e * 2;
@@ -39,8 +37,8 @@ describe('| DyFM_Array', (): void => {
39
37
 
40
38
  describe('| shuffle', () => {
41
39
  it('| should shuffle the elements in the array', () => {
42
- const inputArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
43
- const shuffledArray = [ ...inputArray ];
40
+ const inputArray: number[] = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
41
+ const shuffledArray: number[] = [ ...inputArray ];
44
42
 
45
43
  DyFM_Array.shuffle(shuffledArray);
46
44
 
@@ -67,8 +65,8 @@ describe('| DyFM_Array', (): void => {
67
65
  });
68
66
 
69
67
  describe('| page function', () => {
70
- const array = [ 1, 2, 3, 4, 5, 6, 7, 8 ];
71
- const pageSize = 2;
68
+ const array: number[] = [ 1, 2, 3, 4, 5, 6, 7, 8 ];
69
+ const pageSize: number = 2;
72
70
 
73
71
  it('| should return the correct page of items based on pageIndex and pageSize', () => {
74
72
  expect(DyFM_Array.page(array, 0, pageSize)).toEqual([ 1, 2 ]);
@@ -85,9 +83,9 @@ describe('| DyFM_Array', (): void => {
85
83
 
86
84
  describe('| paged function', () => {
87
85
  it('| should return a paginated array', () => {
88
- const array = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
89
- const pageIndex = 1;
90
- const pageSize = 4;
86
+ const array: number[] = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
87
+ const pageIndex: number = 1;
88
+ const pageSize: number = 4;
91
89
  const expected: DyFM_Paged<any> = {
92
90
  pageIndex: 1,
93
91
  pageSize: 4,
@@ -102,9 +100,9 @@ describe('| DyFM_Array', (): void => {
102
100
  });
103
101
 
104
102
  it('| should handle edge cases like empty array', () => {
105
- const array = [];
106
- const pageIndex = 1;
107
- const pageSize = 5;
103
+ const array: number[] = [];
104
+ const pageIndex: number = 1;
105
+ const pageSize: number = 5;
108
106
  const expected: DyFM_Paged<any> = {
109
107
  pageIndex: 1,
110
108
  pageSize: 5,
@@ -121,18 +119,18 @@ describe('| DyFM_Array', (): void => {
121
119
 
122
120
  describe('| swap function test', () => {
123
121
  it('| should swap elements in the array correctly', () => {
124
- const array = [ 1, 2, 3, 4 ];
125
- const indexA = 0;
126
- const indexB = 2;
127
- const expectedArray = [ 3, 2, 1, 4 ];
122
+ const array: number[] = [ 1, 2, 3, 4 ];
123
+ const indexA: number = 0;
124
+ const indexB: number = 2;
125
+ const expectedArray: number[] = [ 3, 2, 1, 4 ];
128
126
 
129
127
  expect(DyFM_Array.swap(array, indexA, indexB)).toEqual(expectedArray);
130
128
  });
131
129
 
132
130
  it('| should return the same array if same indexes are provided', () => {
133
- const array = [ 1, 2, 3, 4 ];
134
- const indexA = 0;
135
- const indexB = 0;
131
+ const array: number[] = [ 1, 2, 3, 4 ];
132
+ const indexA: number = 0;
133
+ const indexB: number = 0;
136
134
 
137
135
  expect(DyFM_Array.swap(array, indexA, indexB)).toEqual(array);
138
136
  });
@@ -142,11 +140,11 @@ describe('| DyFM_Array', (): void => {
142
140
 
143
141
  describe('| stringListHasMultiplications', () => {
144
142
  it('| should return true if input string array contains duplicates', () => {
145
- const input1 = [ 'apple', 'banana', 'apple', 'orange' ];
143
+ const input1: string[] = [ 'apple', 'banana', 'apple', 'orange' ];
146
144
 
147
145
  expect(DyFM_Array.stringListHasMultiplications(input1)).toBe(true);
148
146
 
149
- const input2 = [ 'apple', 'banana', 'orange' ];
147
+ const input2: string[] = [ 'apple', 'banana', 'orange' ];
150
148
 
151
149
  expect(DyFM_Array.stringListHasMultiplications(input2)).toBe(false);
152
150
  });
@@ -154,8 +152,8 @@ describe('| DyFM_Array', (): void => {
154
152
 
155
153
  describe('| filterStringMultiplications', () => {
156
154
  xit('should return an array with duplicates filtered out', () => {
157
- const inputList = [ 'abc', 'def', 'abc', 'ghi', 'abc' ];
158
- const expectedOutput = [ 'abc' ];
155
+ const inputList: string[] = [ 'abc', 'def', 'abc', 'ghi', 'abc' ];
156
+ const expectedOutput: string[] = [ 'abc' ];
159
157
 
160
158
  const result = DyFM_Array.filterStringMultiplications(inputList);
161
159
 
@@ -163,7 +161,7 @@ describe('| DyFM_Array', (): void => {
163
161
  });
164
162
 
165
163
  it('| should return an empty array if no duplicates are present', () => {
166
- const inputList = [ 'abc', 'def', 'ghi' ];
164
+ const inputList: string[] = [ 'abc', 'def', 'ghi' ];
167
165
  const expectedOutput: string[] = [];
168
166
 
169
167
  const result = DyFM_Array.filterStringMultiplications(inputList);
@@ -183,15 +181,15 @@ describe('| DyFM_Array', (): void => {
183
181
 
184
182
  describe('| gatherStringMultiplications', () => {
185
183
  it('| should return an array of arrays containing duplicated strings', () => {
186
- const input = [ 'apple', 'banana', 'apple', 'cherry', 'banana', 'banana' ];
187
- const expectedOutput = [[ 'apple', 'apple' ], [ 'banana', 'banana', 'banana' ]];
184
+ const input: string[] = [ 'apple', 'banana', 'apple', 'cherry', 'banana', 'banana' ];
185
+ const expectedOutput: string[][] = [[ 'apple', 'apple' ], [ 'banana', 'banana', 'banana' ]];
188
186
 
189
187
  expect(DyFM_Array.gatherStringMultiplications(input)).toEqual(expectedOutput);
190
188
  });
191
189
 
192
190
  it('| should return an empty array for no duplicated strings', () => {
193
- const input = [ 'apple', 'banana', 'cherry' ];
194
- const expectedOutput = [];
191
+ const input: string[] = [ 'apple', 'banana', 'cherry' ];
192
+ const expectedOutput: string[][] = [];
195
193
 
196
194
  expect(DyFM_Array.gatherStringMultiplications(input)).toEqual(expectedOutput);
197
195
  });
@@ -208,7 +206,7 @@ describe('| DyFM_Array', (): void => {
208
206
 
209
207
  describe('| haveMultiplications', () => {
210
208
  it('| should return true if dataList contains any duplicate entry based on the given key', () => {
211
- const dataList = [
209
+ const dataList: { _id: number, name: string }[] = [
212
210
  { _id: 1, name: 'John' },
213
211
  { _id: 2, name: 'Jane' },
214
212
  { _id: 3, name: 'Alice' },
@@ -221,7 +219,7 @@ describe('| DyFM_Array', (): void => {
221
219
  });
222
220
 
223
221
  it('| should return false if dataList does not contain any duplicate entry based on the given key', () => {
224
- const dataList = [
222
+ const dataList: { _id: number, name: string }[] = [
225
223
  { _id: 1, name: 'John' },
226
224
  { _id: 2, name: 'Jane' },
227
225
  { _id: 3, name: 'Alice' },
@@ -236,7 +234,7 @@ describe('| DyFM_Array', (): void => {
236
234
 
237
235
  describe('| filterMultiplications', () => {
238
236
  xit('should filter out duplicate items based on the specified key', () => {
239
- const dataList = [
237
+ const dataList: { _id: number, name: string }[] = [
240
238
  { _id: 1, name: 'Alice' },
241
239
  { _id: 2, name: 'Bob' },
242
240
  { _id: 1, name: 'Charlie' },
@@ -256,7 +254,7 @@ describe('| DyFM_Array', (): void => {
256
254
  });
257
255
 
258
256
  it('| should return an empty array if no duplicates are found', () => {
259
- const dataList = [
257
+ const dataList: { _id: number, name: string }[] = [
260
258
  { _id: 1, name: 'Alice' },
261
259
  { _id: 2, name: 'Bob' },
262
260
  { _id: 3, name: 'Charlie' },
@@ -278,7 +276,7 @@ describe('| DyFM_Array', (): void => {
278
276
 
279
277
  describe('| gatherMultiplications', () => {
280
278
  it('| should gather multiplications based on the specified key', () => {
281
- const dataList = [
279
+ const dataList: { _id: number, name: string }[] = [
282
280
  { _id: 1, name: 'Alice' },
283
281
  { _id: 2, name: 'Bob' },
284
282
  { _id: 1, name: 'Charlie' },
@@ -7,6 +7,12 @@ export type DyFM_List = DyFM_Array;
7
7
 
8
8
  export class DyFM_Array {
9
9
 
10
+ /**
11
+ * Asynchronously iterates over an array and applies a function to each element.
12
+ * @param list - The array to iterate over.
13
+ * @param func - The function to apply to each element.
14
+ * @returns A promise that resolves when all elements have been processed.
15
+ */
10
16
  static async asyncForEach<T>(
11
17
  list: T[],
12
18
  func: (element: T, index?: number, array?: T[]) => Promise<void>
@@ -16,6 +22,13 @@ export class DyFM_Array {
16
22
  }
17
23
  }
18
24
 
25
+ /**
26
+ * Asynchronously iterates over an array and applies a function to each element, returning a single result.
27
+ * @param startData - The initial data to pass to the function.
28
+ * @param list - The array to iterate over.
29
+ * @param func - The function to apply to each element.
30
+ * @returns A promise that resolves to the final result.
31
+ */
19
32
  static async asyncForEachReturnToOne<T, K>(
20
33
  startData: K,
21
34
  list: T[],
@@ -30,6 +43,12 @@ export class DyFM_Array {
30
43
  return result;
31
44
  }
32
45
 
46
+ /**
47
+ * Asynchronously iterates over an array and applies a function to each element, returning an array of results.
48
+ * @param list - The array to iterate over.
49
+ * @param func - The function to apply to each element.
50
+ * @returns A promise that resolves to an array of results.
51
+ */
33
52
  static async asyncForEachReturnToAll<T, K>(
34
53
  list: T[],
35
54
  func: (element: T, index?: number, array?: T[]) => Promise<K>
@@ -43,6 +62,12 @@ export class DyFM_Array {
43
62
  return resultList;
44
63
  }
45
64
 
65
+ /**
66
+ * Asynchronously iterates over an array and applies a function to each element, returning an array of results.
67
+ * @param list - The array to iterate over.
68
+ * @param func - The function to apply to each element.
69
+ * @returns A promise that resolves to an array of results.
70
+ */
46
71
  static async asyncForEachAllAtOnce<T, R>(
47
72
  list: T[],
48
73
  func: (element: T, index?: number, array?: T[]) => Promise<R>
@@ -50,6 +75,12 @@ export class DyFM_Array {
50
75
  return await Promise.all(list.map(func));
51
76
  }
52
77
 
78
+ /**
79
+ * Asynchronously filters an array based on a function.
80
+ * @param list - The array to filter.
81
+ * @param filterFunc - The function to apply to each element.
82
+ * @returns A promise that resolves to an array of results.
83
+ */
53
84
  static async asyncFilter<T>(
54
85
  list: T[],
55
86
  filterFunc: (element: T, index?: number, array?: T[]) => Promise<boolean>
@@ -64,7 +95,13 @@ export class DyFM_Array {
64
95
 
65
96
  return resultList;
66
97
  }
67
-
98
+
99
+ /**
100
+ * Asynchronously maps an array based on a function.
101
+ * @param list - The array to map.
102
+ * @param mapFunc - The function to apply to each element.
103
+ * @returns A promise that resolves to an array of results.
104
+ */
68
105
  static async asyncMap<T, R>(
69
106
  list: T[],
70
107
  mapFunc: (element: T, index?: number, array?: T[]) => Promise<R>
@@ -78,18 +115,39 @@ export class DyFM_Array {
78
115
  return resultList;
79
116
  }
80
117
 
81
- static last<T>(array: T[]): T {
118
+ /**
119
+ * Returns the last element of an array.
120
+ * @param array - The array to get the last element from.
121
+ * @returns The last element of the array, or null if the array is empty.
122
+ */
123
+ static last<T>(array: T[]): T | null {
82
124
  return array?.length ? array[array.length - 1] : null;
83
125
  }
84
126
 
85
- static lastString(array: string): string {
86
- return array?.length ? array[array.length - 1] : null;
127
+ /**
128
+ * Returns the last character of a string.
129
+ * @param string - The string to get the last character from.
130
+ * @returns The last character of the string, or null if the string is empty.
131
+ */
132
+ static lastCharacter(string: string): string | null {
133
+ return string?.length ? string[string.length - 1] : null;
87
134
  }
88
135
 
89
- static first<T>(array: T[]): T {
136
+ /**
137
+ * Returns the first element of an array.
138
+ * @param array - The array to get the first element from.
139
+ * @returns The first element of the array, or null if the array is empty.
140
+ */
141
+ static first<T>(array: T[]): T | null {
90
142
  return array?.length ? array[0] : null;
91
143
  }
92
144
 
145
+ /**
146
+ * Removes an element from an array.
147
+ * @param array - The array to remove the element from.
148
+ * @param element - The element to remove from the array.
149
+ * @returns The array with the element removed.
150
+ */
93
151
  static remove<T>(array: T[], element: T): T[] {
94
152
  const index = array.indexOf(element);
95
153
 
@@ -100,6 +158,12 @@ export class DyFM_Array {
100
158
  return array;
101
159
  }
102
160
 
161
+ /**
162
+ * Finds an element in an array and removes it.
163
+ * @param array - The array to find and remove the element from.
164
+ * @param func - The function to apply to each element.
165
+ * @returns The array with the element removed.
166
+ */
103
167
  static findNRemove<T>(
104
168
  array: T[],
105
169
  func: (element: T, index?: number, array?: T[]) => boolean
@@ -113,6 +177,11 @@ export class DyFM_Array {
113
177
  return array;
114
178
  }
115
179
 
180
+ /**
181
+ * Shuffles an array.
182
+ * @param array - The array to shuffle.
183
+ * @returns The shuffled array.
184
+ */
116
185
  static shuffle<T>(array: T[]): T[] {
117
186
  let currentIndex = array.length;
118
187
  let randomIndex: number;
@@ -127,10 +196,24 @@ export class DyFM_Array {
127
196
  return array;
128
197
  }
129
198
 
199
+ /**
200
+ * Pages an array.
201
+ * @param array - The array to page.
202
+ * @param pageIndex - The index of the page to return.
203
+ * @param pageSize - The size of the page.
204
+ * @returns The page of the array.
205
+ */
130
206
  static page<T>(array: T[], pageIndex: number, pageSize: number): T[] {
131
207
  return array.slice(pageIndex * pageSize, (pageIndex + 1) * pageSize);
132
208
  }
133
209
 
210
+ /**
211
+ * Pages an array.
212
+ * @param array - The array to page.
213
+ * @param pageIndex - The index of the page to return.
214
+ * @param pageSize - The size of the page.
215
+ * @returns The page of the array.
216
+ */
134
217
  static paged<T>(array: T[], pageIndex: number, pageSize: number): DyFM_Paged<T> {
135
218
  return {
136
219
  pageIndex,
@@ -141,26 +224,48 @@ export class DyFM_Array {
141
224
  };
142
225
  }
143
226
 
227
+ /**
228
+ * Swaps two elements in an array.
229
+ * @param array - The array to swap the elements in.
230
+ * @param indexA - The index of the first element to swap.
231
+ * @param indexB - The index of the second element to swap.
232
+ * @returns The array with the elements swapped.
233
+ */
144
234
  static swap<T>(array: T[], indexA: number, indexB: number): T[] {
145
235
  [ array[indexA], array[indexB] ] = [ array[indexB], array[indexA] ];
146
236
 
147
237
  return array;
148
238
  }
149
239
 
240
+ /**
241
+ * Checks if a string list has multiplications.
242
+ * @param stringList - The string list to check.
243
+ * @returns True if the string list has multiplications, false otherwise.
244
+ */
150
245
  static stringListHasMultiplications(stringList: string[]): boolean {
151
246
  return stringList.some((str: string, index: number): boolean => {
152
247
  return stringList.findIndex((strItem: string): boolean => strItem === str) !== index;
153
248
  });
154
249
  }
155
250
 
251
+ /**
252
+ * Filters a string list to remove multiplications.
253
+ * @param stringList - The string list to filter.
254
+ * @returns The filtered string list.
255
+ */
156
256
  static filterStringMultiplications(stringList: string[]): string[] {
157
257
  return stringList.filter((str: string, index: number): boolean => {
158
258
  return stringList.findIndex((strItem: string): boolean => strItem === str) !== index;
159
259
  });
160
260
  }
161
261
 
262
+ /**
263
+ * Gathers multiplications from a string list.
264
+ * @param stringList - The string list to gather multiplications from.
265
+ * @returns The gathered multiplications.
266
+ */
162
267
  static gatherStringMultiplications(stringList: string[]): string[][] {
163
- const multiplications = [];
268
+ const multiplications: string[][] = [];
164
269
 
165
270
  stringList.forEach((str: string, index: number): void => {
166
271
  if (multiplications.find(
@@ -179,7 +284,13 @@ export class DyFM_Array {
179
284
  return multiplications;
180
285
  }
181
286
 
182
- static haveMultiplications<T extends object>(dataList: T[], byKey: string = '_id'): boolean {
287
+ /**
288
+ * Checks if a data list has multiplications.
289
+ * @param dataList - The data list to check.
290
+ * @param byKey - The key to check for multiplications.
291
+ * @returns True if the data list has multiplications, false otherwise.
292
+ */
293
+ static haveMultiplications<T extends object>(dataList: T[], byKey: keyof T = '_id' as keyof T): boolean {
183
294
  return dataList.some((data: T, index: number): boolean => {
184
295
  return dataList.findIndex(
185
296
  (listItem: T): boolean => listItem[byKey] === data[byKey]
@@ -187,7 +298,13 @@ export class DyFM_Array {
187
298
  });
188
299
  }
189
300
 
190
- static filterMultiplications<T extends object>(dataList: T[], byKey: string = '_id'): T[] {
301
+ /**
302
+ * Filters a data list to remove multiplications.
303
+ * @param dataList - The data list to filter.
304
+ * @param byKey - The key to filter for multiplications.
305
+ * @returns The filtered data list.
306
+ */
307
+ static filterMultiplications<T extends object>(dataList: T[], byKey: keyof T = '_id' as keyof T): T[] {
191
308
  return dataList.filter((data: T, index: number): boolean => {
192
309
  return dataList.findIndex(
193
310
  (listItem: T): boolean => listItem[byKey] === data[byKey]
@@ -195,8 +312,14 @@ export class DyFM_Array {
195
312
  });
196
313
  }
197
314
 
198
- static gatherMultiplications<T extends object>(dataList: T[], byKey: string = '_id'): T[][] {
199
- const multiplications = [];
315
+ /**
316
+ * Gathers multiplications from a data list.
317
+ * @param dataList - The data list to gather multiplications from.
318
+ * @param byKey - The key to gather multiplications from.
319
+ * @returns The gathered multiplications.
320
+ */
321
+ static gatherMultiplications<T extends object>(dataList: T[], byKey: keyof T = '_id' as keyof T): T[][] {
322
+ const multiplications: T[][] = [];
200
323
 
201
324
  dataList.forEach((data: T, index: number): void => {
202
325
  if (multiplications.find((multiplication: T[]): boolean => multiplication.includes(data))) {
@@ -213,14 +336,25 @@ export class DyFM_Array {
213
336
  return multiplications;
214
337
  }
215
338
 
216
- static findFromEnd<T>(array: T[], func: (element: T, index?: number, array?: T[]) => boolean): T {
339
+ /**
340
+ * Finds an element in an array from the end.
341
+ * @param array - The array to find the element in.
342
+ * @param func - The function to apply to each element.
343
+ * @returns The element found, or null if no element is found.
344
+ */
345
+ static findFromEnd<T>(
346
+ array: T[],
347
+ func: (element: T, index?: number,
348
+ array?: T[]) => boolean
349
+ ): T | null {
217
350
  for (let i = array.length - 1; i >= 0; i--) {
218
351
  if (func(array[i], i, array)) {
219
352
  return array[i];
220
353
  }
221
354
  }
222
- }
223
355
 
356
+ return null;
357
+ }
224
358
  }
225
359
 
226
360