dce-commonkit 4.4.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 (401) hide show
  1. package/.eslintrc.js +93 -0
  2. package/LICENSE +21 -0
  3. package/README.md +2 -0
  4. package/lib/constants/DAY_IN_MS.d.ts +6 -0
  5. package/lib/constants/DAY_IN_MS.js +9 -0
  6. package/lib/constants/DAY_IN_MS.js.map +1 -0
  7. package/lib/constants/HOUR_IN_MS.d.ts +6 -0
  8. package/lib/constants/HOUR_IN_MS.js +9 -0
  9. package/lib/constants/HOUR_IN_MS.js.map +1 -0
  10. package/lib/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +6 -0
  11. package/lib/constants/LOG_REVIEW_GET_LOGS_ROUTE.js +13 -0
  12. package/lib/constants/LOG_REVIEW_GET_LOGS_ROUTE.js.map +1 -0
  13. package/lib/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +6 -0
  14. package/lib/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.js +13 -0
  15. package/lib/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.js.map +1 -0
  16. package/lib/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +7 -0
  17. package/lib/constants/LOG_REVIEW_STATUS_ROUTE.js +14 -0
  18. package/lib/constants/LOG_REVIEW_STATUS_ROUTE.js.map +1 -0
  19. package/lib/constants/LOG_ROUTE_PATH.d.ts +6 -0
  20. package/lib/constants/LOG_ROUTE_PATH.js +13 -0
  21. package/lib/constants/LOG_ROUTE_PATH.js.map +1 -0
  22. package/lib/constants/MINUTE_IN_MS.d.ts +6 -0
  23. package/lib/constants/MINUTE_IN_MS.js +9 -0
  24. package/lib/constants/MINUTE_IN_MS.js.map +1 -0
  25. package/lib/constants/ROUTE_PATH_PREFIX.d.ts +6 -0
  26. package/lib/constants/ROUTE_PATH_PREFIX.js +9 -0
  27. package/lib/constants/ROUTE_PATH_PREFIX.js.map +1 -0
  28. package/lib/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +6 -0
  29. package/lib/constants/SELECT_ADMIN_CHECK_ROUTE.js +9 -0
  30. package/lib/constants/SELECT_ADMIN_CHECK_ROUTE.js.map +1 -0
  31. package/lib/errors/ErrorWithCode.d.ts +9 -0
  32. package/lib/errors/ErrorWithCode.js +33 -0
  33. package/lib/errors/ErrorWithCode.js.map +1 -0
  34. package/lib/helpers/abbreviate.d.ts +10 -0
  35. package/lib/helpers/abbreviate.js +24 -0
  36. package/lib/helpers/abbreviate.js.map +1 -0
  37. package/lib/helpers/abbreviate.test.d.ts +5 -0
  38. package/lib/helpers/abbreviate.test.js +28 -0
  39. package/lib/helpers/abbreviate.test.js.map +1 -0
  40. package/lib/helpers/asyncArrayFunctions/everyAsync.d.ts +13 -0
  41. package/lib/helpers/asyncArrayFunctions/everyAsync.js +81 -0
  42. package/lib/helpers/asyncArrayFunctions/everyAsync.js.map +1 -0
  43. package/lib/helpers/asyncArrayFunctions/everyAsync.test.d.ts +1 -0
  44. package/lib/helpers/asyncArrayFunctions/everyAsync.test.js +219 -0
  45. package/lib/helpers/asyncArrayFunctions/everyAsync.test.js.map +1 -0
  46. package/lib/helpers/asyncArrayFunctions/filterAsync.d.ts +13 -0
  47. package/lib/helpers/asyncArrayFunctions/filterAsync.js +81 -0
  48. package/lib/helpers/asyncArrayFunctions/filterAsync.js.map +1 -0
  49. package/lib/helpers/asyncArrayFunctions/filterAsync.test.d.ts +1 -0
  50. package/lib/helpers/asyncArrayFunctions/filterAsync.test.js +244 -0
  51. package/lib/helpers/asyncArrayFunctions/filterAsync.test.js.map +1 -0
  52. package/lib/helpers/asyncArrayFunctions/forEachAsync.d.ts +10 -0
  53. package/lib/helpers/asyncArrayFunctions/forEachAsync.js +72 -0
  54. package/lib/helpers/asyncArrayFunctions/forEachAsync.js.map +1 -0
  55. package/lib/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +1 -0
  56. package/lib/helpers/asyncArrayFunctions/forEachAsync.test.js +223 -0
  57. package/lib/helpers/asyncArrayFunctions/forEachAsync.test.js.map +1 -0
  58. package/lib/helpers/asyncArrayFunctions/mapAsync.d.ts +11 -0
  59. package/lib/helpers/asyncArrayFunctions/mapAsync.js +77 -0
  60. package/lib/helpers/asyncArrayFunctions/mapAsync.js.map +1 -0
  61. package/lib/helpers/asyncArrayFunctions/mapAsync.test.d.ts +1 -0
  62. package/lib/helpers/asyncArrayFunctions/mapAsync.test.js +219 -0
  63. package/lib/helpers/asyncArrayFunctions/mapAsync.test.js.map +1 -0
  64. package/lib/helpers/asyncArrayFunctions/someAsync.d.ts +13 -0
  65. package/lib/helpers/asyncArrayFunctions/someAsync.js +80 -0
  66. package/lib/helpers/asyncArrayFunctions/someAsync.js.map +1 -0
  67. package/lib/helpers/asyncArrayFunctions/someAsync.test.d.ts +1 -0
  68. package/lib/helpers/asyncArrayFunctions/someAsync.test.js +227 -0
  69. package/lib/helpers/asyncArrayFunctions/someAsync.test.js.map +1 -0
  70. package/lib/helpers/avg.d.ts +8 -0
  71. package/lib/helpers/avg.js +24 -0
  72. package/lib/helpers/avg.js.map +1 -0
  73. package/lib/helpers/avg.test.d.ts +5 -0
  74. package/lib/helpers/avg.test.js +25 -0
  75. package/lib/helpers/avg.test.js.map +1 -0
  76. package/lib/helpers/capitalize.d.ts +7 -0
  77. package/lib/helpers/capitalize.js +20 -0
  78. package/lib/helpers/capitalize.js.map +1 -0
  79. package/lib/helpers/ceilToNumDecimals.d.ts +9 -0
  80. package/lib/helpers/ceilToNumDecimals.js +15 -0
  81. package/lib/helpers/ceilToNumDecimals.js.map +1 -0
  82. package/lib/helpers/ceilToNumDecimals.test.d.ts +5 -0
  83. package/lib/helpers/ceilToNumDecimals.test.js +38 -0
  84. package/lib/helpers/ceilToNumDecimals.test.js.map +1 -0
  85. package/lib/helpers/cloneDeep.d.ts +8 -0
  86. package/lib/helpers/cloneDeep.js +15 -0
  87. package/lib/helpers/cloneDeep.js.map +1 -0
  88. package/lib/helpers/compareArraysByProp.d.ts +13 -0
  89. package/lib/helpers/compareArraysByProp.js +62 -0
  90. package/lib/helpers/compareArraysByProp.js.map +1 -0
  91. package/lib/helpers/compareArraysByProp.test.d.ts +5 -0
  92. package/lib/helpers/compareArraysByProp.test.js +140 -0
  93. package/lib/helpers/compareArraysByProp.test.js.map +1 -0
  94. package/lib/helpers/extractProp.d.ts +12 -0
  95. package/lib/helpers/extractProp.js +19 -0
  96. package/lib/helpers/extractProp.js.map +1 -0
  97. package/lib/helpers/extractProp.test.d.ts +5 -0
  98. package/lib/helpers/extractProp.test.js +36 -0
  99. package/lib/helpers/extractProp.test.js.map +1 -0
  100. package/lib/helpers/floorToNumDecimals.d.ts +9 -0
  101. package/lib/helpers/floorToNumDecimals.js +15 -0
  102. package/lib/helpers/floorToNumDecimals.js.map +1 -0
  103. package/lib/helpers/floorToNumDecimals.test.d.ts +5 -0
  104. package/lib/helpers/floorToNumDecimals.test.js +38 -0
  105. package/lib/helpers/floorToNumDecimals.test.js.map +1 -0
  106. package/lib/helpers/forceNumIntoBounds.d.ts +10 -0
  107. package/lib/helpers/forceNumIntoBounds.js +15 -0
  108. package/lib/helpers/forceNumIntoBounds.js.map +1 -0
  109. package/lib/helpers/forceNumIntoBounds.test.d.ts +5 -0
  110. package/lib/helpers/forceNumIntoBounds.test.js +34 -0
  111. package/lib/helpers/forceNumIntoBounds.test.js.map +1 -0
  112. package/lib/helpers/genCSV.d.ts +18 -0
  113. package/lib/helpers/genCSV.js +69 -0
  114. package/lib/helpers/genCSV.js.map +1 -0
  115. package/lib/helpers/genCSV.test.d.ts +5 -0
  116. package/lib/helpers/genCSV.test.js +75 -0
  117. package/lib/helpers/genCSV.test.js.map +1 -0
  118. package/lib/helpers/genCommaList.d.ts +12 -0
  119. package/lib/helpers/genCommaList.js +20 -0
  120. package/lib/helpers/genCommaList.js.map +1 -0
  121. package/lib/helpers/genCommaList.test.d.ts +1 -0
  122. package/lib/helpers/genCommaList.test.js +94 -0
  123. package/lib/helpers/genCommaList.test.js.map +1 -0
  124. package/lib/helpers/getHumanReadableDate.d.ts +8 -0
  125. package/lib/helpers/getHumanReadableDate.js +32 -0
  126. package/lib/helpers/getHumanReadableDate.js.map +1 -0
  127. package/lib/helpers/getHumanReadableDate.test.d.ts +5 -0
  128. package/lib/helpers/getHumanReadableDate.test.js +31 -0
  129. package/lib/helpers/getHumanReadableDate.test.js.map +1 -0
  130. package/lib/helpers/getLocalTimeInfo.d.ts +19 -0
  131. package/lib/helpers/getLocalTimeInfo.js +51 -0
  132. package/lib/helpers/getLocalTimeInfo.js.map +1 -0
  133. package/lib/helpers/getLocalTimeInfo.test.d.ts +6 -0
  134. package/lib/helpers/getLocalTimeInfo.test.js +50 -0
  135. package/lib/helpers/getLocalTimeInfo.test.js.map +1 -0
  136. package/lib/helpers/getMonthName.d.ts +14 -0
  137. package/lib/helpers/getMonthName.js +31 -0
  138. package/lib/helpers/getMonthName.js.map +1 -0
  139. package/lib/helpers/getMonthName.test.d.ts +5 -0
  140. package/lib/helpers/getMonthName.test.js +70 -0
  141. package/lib/helpers/getMonthName.test.js.map +1 -0
  142. package/lib/helpers/getOrdinal.d.ts +8 -0
  143. package/lib/helpers/getOrdinal.js +16 -0
  144. package/lib/helpers/getOrdinal.js.map +1 -0
  145. package/lib/helpers/getOrdinal.test.d.ts +5 -0
  146. package/lib/helpers/getOrdinal.test.js +74 -0
  147. package/lib/helpers/getOrdinal.test.js.map +1 -0
  148. package/lib/helpers/getPartOfDay.d.ts +7 -0
  149. package/lib/helpers/getPartOfDay.js +24 -0
  150. package/lib/helpers/getPartOfDay.js.map +1 -0
  151. package/lib/helpers/getPartOfDay.test.d.ts +5 -0
  152. package/lib/helpers/getPartOfDay.test.js +49 -0
  153. package/lib/helpers/getPartOfDay.test.js.map +1 -0
  154. package/lib/helpers/getTimeInfoInET.d.ts +21 -0
  155. package/lib/helpers/getTimeInfoInET.js +67 -0
  156. package/lib/helpers/getTimeInfoInET.js.map +1 -0
  157. package/lib/helpers/getTimeInfoInET.test.d.ts +5 -0
  158. package/lib/helpers/getTimeInfoInET.test.js +74 -0
  159. package/lib/helpers/getTimeInfoInET.test.js.map +1 -0
  160. package/lib/helpers/getTimestampFromTimeInfoInET.d.ts +20 -0
  161. package/lib/helpers/getTimestampFromTimeInfoInET.js +136 -0
  162. package/lib/helpers/getTimestampFromTimeInfoInET.js.map +1 -0
  163. package/lib/helpers/getWordCount.d.ts +10 -0
  164. package/lib/helpers/getWordCount.js +24 -0
  165. package/lib/helpers/getWordCount.js.map +1 -0
  166. package/lib/helpers/idify.d.ts +9 -0
  167. package/lib/helpers/idify.js +24 -0
  168. package/lib/helpers/idify.js.map +1 -0
  169. package/lib/helpers/onlyKeepLetters.d.ts +8 -0
  170. package/lib/helpers/onlyKeepLetters.js +13 -0
  171. package/lib/helpers/onlyKeepLetters.js.map +1 -0
  172. package/lib/helpers/padDecimalZeros.d.ts +10 -0
  173. package/lib/helpers/padDecimalZeros.js +30 -0
  174. package/lib/helpers/padDecimalZeros.js.map +1 -0
  175. package/lib/helpers/padZerosLeft.d.ts +9 -0
  176. package/lib/helpers/padZerosLeft.js +21 -0
  177. package/lib/helpers/padZerosLeft.js.map +1 -0
  178. package/lib/helpers/parallelLimit.d.ts +12 -0
  179. package/lib/helpers/parallelLimit.js +104 -0
  180. package/lib/helpers/parallelLimit.js.map +1 -0
  181. package/lib/helpers/prefixWithAOrAn.d.ts +10 -0
  182. package/lib/helpers/prefixWithAOrAn.js +28 -0
  183. package/lib/helpers/prefixWithAOrAn.js.map +1 -0
  184. package/lib/helpers/roundToNumDecimals.d.ts +9 -0
  185. package/lib/helpers/roundToNumDecimals.js +15 -0
  186. package/lib/helpers/roundToNumDecimals.js.map +1 -0
  187. package/lib/helpers/shuffleArray.d.ts +8 -0
  188. package/lib/helpers/shuffleArray.js +29 -0
  189. package/lib/helpers/shuffleArray.js.map +1 -0
  190. package/lib/helpers/startMinWait.d.ts +9 -0
  191. package/lib/helpers/startMinWait.js +79 -0
  192. package/lib/helpers/startMinWait.js.map +1 -0
  193. package/lib/helpers/stringsToHumanReadableList.d.ts +10 -0
  194. package/lib/helpers/stringsToHumanReadableList.js +37 -0
  195. package/lib/helpers/stringsToHumanReadableList.js.map +1 -0
  196. package/lib/helpers/sum.d.ts +8 -0
  197. package/lib/helpers/sum.js +15 -0
  198. package/lib/helpers/sum.js.map +1 -0
  199. package/lib/helpers/validators/ChicagoTitleCase.d.ts +9 -0
  200. package/lib/helpers/validators/ChicagoTitleCase.js +31 -0
  201. package/lib/helpers/validators/ChicagoTitleCase.js.map +1 -0
  202. package/lib/helpers/validators/ChicagoTitleCase.test.d.ts +0 -0
  203. package/lib/helpers/validators/ChicagoTitleCase.test.js +79 -0
  204. package/lib/helpers/validators/ChicagoTitleCase.test.js.map +1 -0
  205. package/lib/helpers/validators/findURL.d.ts +0 -0
  206. package/lib/helpers/validators/findURL.js +39 -0
  207. package/lib/helpers/validators/findURL.js.map +1 -0
  208. package/lib/helpers/validators/findURL.test.d.ts +0 -0
  209. package/lib/helpers/validators/findURL.test.js +77 -0
  210. package/lib/helpers/validators/findURL.test.js.map +1 -0
  211. package/lib/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +10 -0
  212. package/lib/helpers/validators/shared/constants/ERROR_MESSAGES.js +21 -0
  213. package/lib/helpers/validators/shared/constants/ERROR_MESSAGES.js.map +1 -0
  214. package/lib/helpers/validators/shared/helpers/validateRegex.d.ts +19 -0
  215. package/lib/helpers/validators/shared/helpers/validateRegex.js +34 -0
  216. package/lib/helpers/validators/shared/helpers/validateRegex.js.map +1 -0
  217. package/lib/helpers/validators/shared/types/ValidationResult.d.ts +12 -0
  218. package/lib/helpers/validators/shared/types/ValidationResult.js +3 -0
  219. package/lib/helpers/validators/shared/types/ValidationResult.js.map +1 -0
  220. package/lib/helpers/validators/validURL.d.ts +8 -0
  221. package/lib/helpers/validators/validURL.js +20 -0
  222. package/lib/helpers/validators/validURL.js.map +1 -0
  223. package/lib/helpers/validators/validURL.test.d.ts +0 -0
  224. package/lib/helpers/validators/validURL.test.js +83 -0
  225. package/lib/helpers/validators/validURL.test.js.map +1 -0
  226. package/lib/helpers/validators/validateEmail.d.ts +11 -0
  227. package/lib/helpers/validators/validateEmail.js +39 -0
  228. package/lib/helpers/validators/validateEmail.js.map +1 -0
  229. package/lib/helpers/validators/validateEmail.test.d.ts +1 -0
  230. package/lib/helpers/validators/validateEmail.test.js +140 -0
  231. package/lib/helpers/validators/validateEmail.test.js.map +1 -0
  232. package/lib/helpers/validators/validatePhoneNumber.d.ts +11 -0
  233. package/lib/helpers/validators/validatePhoneNumber.js +40 -0
  234. package/lib/helpers/validators/validatePhoneNumber.js.map +1 -0
  235. package/lib/helpers/validators/validatePhoneNumber.test.d.ts +1 -0
  236. package/lib/helpers/validators/validatePhoneNumber.test.js +123 -0
  237. package/lib/helpers/validators/validatePhoneNumber.test.js.map +1 -0
  238. package/lib/helpers/validators/validateString.d.ts +22 -0
  239. package/lib/helpers/validators/validateString.js +124 -0
  240. package/lib/helpers/validators/validateString.js.map +1 -0
  241. package/lib/helpers/validators/validateString.test.d.ts +1 -0
  242. package/lib/helpers/validators/validateString.test.js +163 -0
  243. package/lib/helpers/validators/validateString.test.js.map +1 -0
  244. package/lib/helpers/waitMs.d.ts +7 -0
  245. package/lib/helpers/waitMs.js +68 -0
  246. package/lib/helpers/waitMs.js.map +1 -0
  247. package/lib/index.d.ts +63 -0
  248. package/lib/index.js +124 -0
  249. package/lib/index.js.map +1 -0
  250. package/lib/types/CommonKitErrorCode.d.ts +10 -0
  251. package/lib/types/CommonKitErrorCode.js +15 -0
  252. package/lib/types/CommonKitErrorCode.js.map +1 -0
  253. package/lib/types/DayOfWeek.d.ts +14 -0
  254. package/lib/types/DayOfWeek.js +18 -0
  255. package/lib/types/DayOfWeek.js.map +1 -0
  256. package/lib/types/Log/LogMainInfo.d.ts +39 -0
  257. package/lib/types/Log/LogMainInfo.js +3 -0
  258. package/lib/types/Log/LogMainInfo.js.map +1 -0
  259. package/lib/types/Log/LogSourceSpecificInfo.d.ts +13 -0
  260. package/lib/types/Log/LogSourceSpecificInfo.js +3 -0
  261. package/lib/types/Log/LogSourceSpecificInfo.js.map +1 -0
  262. package/lib/types/Log/LogTypeSpecificInfo.d.ts +17 -0
  263. package/lib/types/Log/LogTypeSpecificInfo.js +3 -0
  264. package/lib/types/Log/LogTypeSpecificInfo.js.map +1 -0
  265. package/lib/types/Log/index.d.ts +10 -0
  266. package/lib/types/Log/index.js +3 -0
  267. package/lib/types/Log/index.js.map +1 -0
  268. package/lib/types/LogAction.d.ts +29 -0
  269. package/lib/types/LogAction.js +55 -0
  270. package/lib/types/LogAction.js.map +1 -0
  271. package/lib/types/LogBuiltInMetadata.d.ts +16 -0
  272. package/lib/types/LogBuiltInMetadata.js +21 -0
  273. package/lib/types/LogBuiltInMetadata.js.map +1 -0
  274. package/lib/types/LogFunction.d.ts +24 -0
  275. package/lib/types/LogFunction.js +3 -0
  276. package/lib/types/LogFunction.js.map +1 -0
  277. package/lib/types/LogLevel.d.ts +10 -0
  278. package/lib/types/LogLevel.js +14 -0
  279. package/lib/types/LogLevel.js.map +1 -0
  280. package/lib/types/LogMetadataContextMap.d.ts +11 -0
  281. package/lib/types/LogMetadataContextMap.js +3 -0
  282. package/lib/types/LogMetadataContextMap.js.map +1 -0
  283. package/lib/types/LogMetadataTagMap.d.ts +8 -0
  284. package/lib/types/LogMetadataTagMap.js +3 -0
  285. package/lib/types/LogMetadataTagMap.js.map +1 -0
  286. package/lib/types/LogMetadataTargetMap.d.ts +8 -0
  287. package/lib/types/LogMetadataTargetMap.js +3 -0
  288. package/lib/types/LogMetadataTargetMap.js.map +1 -0
  289. package/lib/types/LogMetadataType.d.ts +13 -0
  290. package/lib/types/LogMetadataType.js +3 -0
  291. package/lib/types/LogMetadataType.js.map +1 -0
  292. package/lib/types/LogSource.d.ts +9 -0
  293. package/lib/types/LogSource.js +15 -0
  294. package/lib/types/LogSource.js.map +1 -0
  295. package/lib/types/LogType.d.ts +9 -0
  296. package/lib/types/LogType.js +15 -0
  297. package/lib/types/LogType.js.map +1 -0
  298. package/lib/types/ParamType.d.ts +17 -0
  299. package/lib/types/ParamType.js +21 -0
  300. package/lib/types/ParamType.js.map +1 -0
  301. package/package.json +47 -0
  302. package/src/constants/DAY_IN_MS.ts +7 -0
  303. package/src/constants/HOUR_IN_MS.ts +7 -0
  304. package/src/constants/LOG_REVIEW_GET_LOGS_ROUTE.ts +9 -0
  305. package/src/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.ts +9 -0
  306. package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +10 -0
  307. package/src/constants/LOG_ROUTE_PATH.ts +9 -0
  308. package/src/constants/MINUTE_IN_MS.ts +7 -0
  309. package/src/constants/ROUTE_PATH_PREFIX.ts +7 -0
  310. package/src/constants/SELECT_ADMIN_CHECK_ROUTE.ts +7 -0
  311. package/src/errors/ErrorWithCode.ts +15 -0
  312. package/src/helpers/abbreviate.test.ts +26 -0
  313. package/src/helpers/abbreviate.ts +25 -0
  314. package/src/helpers/asyncArrayFunctions/everyAsync.test.ts +114 -0
  315. package/src/helpers/asyncArrayFunctions/everyAsync.ts +51 -0
  316. package/src/helpers/asyncArrayFunctions/filterAsync.test.ts +126 -0
  317. package/src/helpers/asyncArrayFunctions/filterAsync.ts +50 -0
  318. package/src/helpers/asyncArrayFunctions/forEachAsync.test.ts +136 -0
  319. package/src/helpers/asyncArrayFunctions/forEachAsync.ts +40 -0
  320. package/src/helpers/asyncArrayFunctions/mapAsync.test.ts +125 -0
  321. package/src/helpers/asyncArrayFunctions/mapAsync.ts +46 -0
  322. package/src/helpers/asyncArrayFunctions/someAsync.test.ts +92 -0
  323. package/src/helpers/asyncArrayFunctions/someAsync.ts +49 -0
  324. package/src/helpers/avg.test.ts +24 -0
  325. package/src/helpers/avg.ts +22 -0
  326. package/src/helpers/capitalize.ts +20 -0
  327. package/src/helpers/ceilToNumDecimals.test.ts +39 -0
  328. package/src/helpers/ceilToNumDecimals.ts +13 -0
  329. package/src/helpers/cloneDeep.ts +11 -0
  330. package/src/helpers/compareArraysByProp.test.ts +147 -0
  331. package/src/helpers/compareArraysByProp.ts +56 -0
  332. package/src/helpers/extractProp.test.ts +34 -0
  333. package/src/helpers/extractProp.ts +17 -0
  334. package/src/helpers/floorToNumDecimals.test.ts +39 -0
  335. package/src/helpers/floorToNumDecimals.ts +13 -0
  336. package/src/helpers/forceNumIntoBounds.test.ts +34 -0
  337. package/src/helpers/forceNumIntoBounds.ts +19 -0
  338. package/src/helpers/genCSV.test.ts +77 -0
  339. package/src/helpers/genCSV.ts +87 -0
  340. package/src/helpers/genCommaList.test.ts +57 -0
  341. package/src/helpers/genCommaList.ts +21 -0
  342. package/src/helpers/getHumanReadableDate.test.ts +29 -0
  343. package/src/helpers/getHumanReadableDate.ts +36 -0
  344. package/src/helpers/getLocalTimeInfo.test.ts +48 -0
  345. package/src/helpers/getLocalTimeInfo.ts +58 -0
  346. package/src/helpers/getMonthName.test.ts +79 -0
  347. package/src/helpers/getMonthName.ts +29 -0
  348. package/src/helpers/getOrdinal.test.ts +84 -0
  349. package/src/helpers/getOrdinal.ts +14 -0
  350. package/src/helpers/getPartOfDay.test.ts +56 -0
  351. package/src/helpers/getPartOfDay.ts +20 -0
  352. package/src/helpers/getTimeInfoInET.test.ts +72 -0
  353. package/src/helpers/getTimeInfoInET.ts +79 -0
  354. package/src/helpers/getTimestampFromTimeInfoInET.ts +179 -0
  355. package/src/helpers/getWordCount.ts +26 -0
  356. package/src/helpers/idify.ts +24 -0
  357. package/src/helpers/onlyKeepLetters.ts +11 -0
  358. package/src/helpers/padDecimalZeros.ts +32 -0
  359. package/src/helpers/padZerosLeft.ts +21 -0
  360. package/src/helpers/parallelLimit.ts +63 -0
  361. package/src/helpers/prefixWithAOrAn.ts +29 -0
  362. package/src/helpers/roundToNumDecimals.ts +13 -0
  363. package/src/helpers/shuffleArray.ts +19 -0
  364. package/src/helpers/startMinWait.ts +33 -0
  365. package/src/helpers/stringsToHumanReadableList.ts +39 -0
  366. package/src/helpers/sum.ts +16 -0
  367. package/src/helpers/validators/ChicagoTitleCase.test.ts +85 -0
  368. package/src/helpers/validators/ChicagoTitleCase.ts +32 -0
  369. package/src/helpers/validators/findURL.test.ts +83 -0
  370. package/src/helpers/validators/findURL.ts +43 -0
  371. package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +18 -0
  372. package/src/helpers/validators/shared/helpers/validateRegex.ts +47 -0
  373. package/src/helpers/validators/shared/types/ValidationResult.ts +20 -0
  374. package/src/helpers/validators/validURL.test.ts +90 -0
  375. package/src/helpers/validators/validURL.ts +18 -0
  376. package/src/helpers/validators/validateEmail.test.ts +110 -0
  377. package/src/helpers/validators/validateEmail.ts +47 -0
  378. package/src/helpers/validators/validatePhoneNumber.test.ts +94 -0
  379. package/src/helpers/validators/validatePhoneNumber.ts +49 -0
  380. package/src/helpers/validators/validateString.test.ts +173 -0
  381. package/src/helpers/validators/validateString.ts +171 -0
  382. package/src/helpers/waitMs.ts +12 -0
  383. package/src/index.ts +139 -0
  384. package/src/types/CommonKitErrorCode.ts +13 -0
  385. package/src/types/DayOfWeek.ts +15 -0
  386. package/src/types/Log/LogMainInfo.ts +69 -0
  387. package/src/types/Log/LogSourceSpecificInfo.ts +25 -0
  388. package/src/types/Log/LogTypeSpecificInfo.ts +33 -0
  389. package/src/types/Log/index.ts +17 -0
  390. package/src/types/LogAction.ts +52 -0
  391. package/src/types/LogBuiltInMetadata.ts +19 -0
  392. package/src/types/LogFunction.ts +46 -0
  393. package/src/types/LogLevel.ts +11 -0
  394. package/src/types/LogMetadataContextMap.ts +15 -0
  395. package/src/types/LogMetadataTagMap.ts +9 -0
  396. package/src/types/LogMetadataTargetMap.ts +9 -0
  397. package/src/types/LogMetadataType.ts +16 -0
  398. package/src/types/LogSource.ts +12 -0
  399. package/src/types/LogType.ts +12 -0
  400. package/src/types/ParamType.ts +18 -0
  401. package/tsconfig.json +19 -0
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ // Import item to test
43
+ var everyAsync_1 = __importDefault(require("./everyAsync"));
44
+ describe('everyAsync', function () {
45
+ it('returns true for an empty array', function () { return __awaiter(void 0, void 0, void 0, function () {
46
+ var result;
47
+ return __generator(this, function (_a) {
48
+ switch (_a.label) {
49
+ case 0: return [4 /*yield*/, (0, everyAsync_1.default)([], function () { return __awaiter(void 0, void 0, void 0, function () {
50
+ return __generator(this, function (_a) {
51
+ return [2 /*return*/, true];
52
+ });
53
+ }); })];
54
+ case 1:
55
+ result = _a.sent();
56
+ expect(result).toBe(true);
57
+ return [2 /*return*/];
58
+ }
59
+ });
60
+ }); });
61
+ it('returns true if the operator function returns true for every item in the array', function () { return __awaiter(void 0, void 0, void 0, function () {
62
+ var result;
63
+ return __generator(this, function (_a) {
64
+ switch (_a.label) {
65
+ case 0: return [4 /*yield*/, (0, everyAsync_1.default)([1, 2, 3], function (item) { return __awaiter(void 0, void 0, void 0, function () {
66
+ return __generator(this, function (_a) {
67
+ return [2 /*return*/, item > 0];
68
+ });
69
+ }); })];
70
+ case 1:
71
+ result = _a.sent();
72
+ expect(result).toBe(true);
73
+ return [2 /*return*/];
74
+ }
75
+ });
76
+ }); });
77
+ it('returns false if the operator function returns false for any item in the array', function () { return __awaiter(void 0, void 0, void 0, function () {
78
+ var result;
79
+ return __generator(this, function (_a) {
80
+ switch (_a.label) {
81
+ case 0: return [4 /*yield*/, (0, everyAsync_1.default)([1, 2, 3], function (item) { return __awaiter(void 0, void 0, void 0, function () {
82
+ return __generator(this, function (_a) {
83
+ return [2 /*return*/, item > 1];
84
+ });
85
+ }); })];
86
+ case 1:
87
+ result = _a.sent();
88
+ expect(result).toBe(false);
89
+ return [2 /*return*/];
90
+ }
91
+ });
92
+ }); });
93
+ it('passes the index as the second argument to the operator function', function () { return __awaiter(void 0, void 0, void 0, function () {
94
+ var result;
95
+ return __generator(this, function (_a) {
96
+ switch (_a.label) {
97
+ case 0: return [4 /*yield*/, (0, everyAsync_1.default)([1, 2, 3], function (item, index) { return __awaiter(void 0, void 0, void 0, function () {
98
+ return __generator(this, function (_a) {
99
+ return [2 /*return*/, index === item - 1];
100
+ });
101
+ }); })];
102
+ case 1:
103
+ result = _a.sent();
104
+ expect(result).toBe(true);
105
+ return [2 /*return*/];
106
+ }
107
+ });
108
+ }); });
109
+ it('passes an object with a breakNow function and the array as the third argument to the operator function', function () { return __awaiter(void 0, void 0, void 0, function () {
110
+ var result;
111
+ return __generator(this, function (_a) {
112
+ switch (_a.label) {
113
+ case 0: return [4 /*yield*/, (0, everyAsync_1.default)([1, 2, 3], function (item_1, index_1, _a) { return __awaiter(void 0, [item_1, index_1, _a], void 0, function (item, index, _b) {
114
+ var breakNow = _b.breakNow;
115
+ return __generator(this, function (_c) {
116
+ if (item === 2) {
117
+ breakNow();
118
+ }
119
+ return [2 /*return*/, true];
120
+ });
121
+ }); })];
122
+ case 1:
123
+ result = _a.sent();
124
+ expect(result).toBe(false);
125
+ return [2 /*return*/];
126
+ }
127
+ });
128
+ }); });
129
+ it('stops iterating if the operator function calls the breakNow function', function () { return __awaiter(void 0, void 0, void 0, function () {
130
+ var mockOperatorFunction, result;
131
+ return __generator(this, function (_a) {
132
+ switch (_a.label) {
133
+ case 0:
134
+ mockOperatorFunction = jest.fn(function (item_1, index_1, _a) { return __awaiter(void 0, [item_1, index_1, _a], void 0, function (item, index, _b) {
135
+ var breakNow = _b.breakNow;
136
+ return __generator(this, function (_c) {
137
+ if (item === 2) {
138
+ breakNow();
139
+ }
140
+ return [2 /*return*/, true];
141
+ });
142
+ }); });
143
+ return [4 /*yield*/, (0, everyAsync_1.default)([1, 2, 3], mockOperatorFunction)];
144
+ case 1:
145
+ result = _a.sent();
146
+ expect(result).toBe(false);
147
+ expect(mockOperatorFunction).toHaveBeenCalledTimes(2);
148
+ return [2 /*return*/];
149
+ }
150
+ });
151
+ }); });
152
+ it('handles an operator function that returns a promise that resolves to true', function () { return __awaiter(void 0, void 0, void 0, function () {
153
+ var result;
154
+ return __generator(this, function (_a) {
155
+ switch (_a.label) {
156
+ case 0: return [4 /*yield*/, (0, everyAsync_1.default)([1, 2, 3], function (item) { return __awaiter(void 0, void 0, void 0, function () {
157
+ return __generator(this, function (_a) {
158
+ return [2 /*return*/, Promise.resolve(item > 0)];
159
+ });
160
+ }); })];
161
+ case 1:
162
+ result = _a.sent();
163
+ expect(result).toBe(true);
164
+ return [2 /*return*/];
165
+ }
166
+ });
167
+ }); });
168
+ it('handles an operator function that returns a promise that resolves to false', function () { return __awaiter(void 0, void 0, void 0, function () {
169
+ var result;
170
+ return __generator(this, function (_a) {
171
+ switch (_a.label) {
172
+ case 0: return [4 /*yield*/, (0, everyAsync_1.default)([1, 2, 3], function (item) { return __awaiter(void 0, void 0, void 0, function () {
173
+ return __generator(this, function (_a) {
174
+ return [2 /*return*/, Promise.resolve(item > 1)];
175
+ });
176
+ }); })];
177
+ case 1:
178
+ result = _a.sent();
179
+ expect(result).toBe(false);
180
+ return [2 /*return*/];
181
+ }
182
+ });
183
+ }); });
184
+ it('handles an operator function that throws an error', function () { return __awaiter(void 0, void 0, void 0, function () {
185
+ var mockOperatorFunction, error, result, err_1;
186
+ return __generator(this, function (_a) {
187
+ switch (_a.label) {
188
+ case 0:
189
+ mockOperatorFunction = jest.fn(function (item) { return __awaiter(void 0, void 0, void 0, function () {
190
+ return __generator(this, function (_a) {
191
+ if (item === 2) {
192
+ throw new Error('Test error');
193
+ }
194
+ return [2 /*return*/, true];
195
+ });
196
+ }); });
197
+ error = null;
198
+ result = null;
199
+ _a.label = 1;
200
+ case 1:
201
+ _a.trys.push([1, 3, , 4]);
202
+ return [4 /*yield*/, (0, everyAsync_1.default)([1, 2, 3], mockOperatorFunction)];
203
+ case 2:
204
+ result = _a.sent();
205
+ return [3 /*break*/, 4];
206
+ case 3:
207
+ err_1 = _a.sent();
208
+ error = err_1;
209
+ return [3 /*break*/, 4];
210
+ case 4:
211
+ expect(result).toBe(null);
212
+ expect(error).not.toBe(null);
213
+ expect(mockOperatorFunction).toHaveBeenCalledTimes(2);
214
+ return [2 /*return*/];
215
+ }
216
+ });
217
+ }); });
218
+ });
219
+ //# sourceMappingURL=everyAsync.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"everyAsync.test.js","sourceRoot":"","sources":["../../../src/helpers/asyncArrayFunctions/everyAsync.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sBAAsB;AACtB,4DAAsC;AAEtC,QAAQ,CAAC,YAAY,EAAE;IACrB,EAAE,CAAC,iCAAiC,EAAE;;;;wBACrB,qBAAM,IAAA,oBAAU,EAC7B,EAAE,EACF;;4BACE,sBAAO,IAAI,EAAC;;yBACb,CACF,EAAA;;oBALK,MAAM,GAAG,SAKd;oBACD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;SAC3B,CAAC,CAAC;IAEH,EAAE,CAAC,gFAAgF,EAAE;;;;wBACpE,qBAAM,IAAA,oBAAU,EAC7B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACT,UAAO,IAAI;;4BACT,sBAAO,IAAI,GAAG,CAAC,EAAC;;yBACjB,CACF,EAAA;;oBALK,MAAM,GAAG,SAKd;oBACD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;;SAC3B,CAAC,CAAC;IAEH,EAAE,CAAC,gFAAgF,EAAE;;;;wBAC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CAAC,CAAC;oBACC,KAAK,GAAQ,IAAI,CAAC;oBAClB,MAAM,GAAmB,IAAI,CAAC;;;;oBAEvB,qBAAM,IAAA,oBAAU,EACvB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACT,oBAAoB,CACrB,EAAA;;oBAHD,MAAM,GAAG,SAGR,CAAC;;;;oBAEF,KAAK,GAAG,KAAG,CAAC;;;oBAEd,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC1B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC7B,MAAM,CAAC,oBAAoB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;;;;SACvD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Run the operator function on each item in the array, returning a new array
3
+ * that only contains the items that pass the filter
4
+ * @author Gabe Abrams
5
+ * @param operatorFunction the operator function to apply. If it returns true
6
+ * for an item, the item will be included in the returned array
7
+ * @returns the filtered array
8
+ */
9
+ declare const filterAsync: <T>(array: T[], operatorFunction: (item: T, index: number, opts: {
10
+ breakNow: () => void;
11
+ array: Array<T>;
12
+ }) => Promise<any>) => Promise<T[]>;
13
+ export default filterAsync;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ /**
40
+ * Run the operator function on each item in the array, returning a new array
41
+ * that only contains the items that pass the filter
42
+ * @author Gabe Abrams
43
+ * @param operatorFunction the operator function to apply. If it returns true
44
+ * for an item, the item will be included in the returned array
45
+ * @returns the filtered array
46
+ */
47
+ var filterAsync = function (array, operatorFunction) { return __awaiter(void 0, void 0, void 0, function () {
48
+ var done, breakNow, output, i, included;
49
+ return __generator(this, function (_a) {
50
+ switch (_a.label) {
51
+ case 0:
52
+ done = false;
53
+ breakNow = function () {
54
+ done = true;
55
+ };
56
+ output = [];
57
+ i = 0;
58
+ _a.label = 1;
59
+ case 1:
60
+ if (!(i < array.length && !done)) return [3 /*break*/, 4];
61
+ return [4 /*yield*/, operatorFunction(array[i], i, {
62
+ breakNow: breakNow,
63
+ array: array,
64
+ })];
65
+ case 2:
66
+ included = _a.sent();
67
+ if (included && !done) {
68
+ output.push(array[i]);
69
+ }
70
+ _a.label = 3;
71
+ case 3:
72
+ i++;
73
+ return [3 /*break*/, 1];
74
+ case 4:
75
+ // Return results
76
+ return [2 /*return*/, output];
77
+ }
78
+ });
79
+ }); };
80
+ exports.default = filterAsync;
81
+ //# sourceMappingURL=filterAsync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterAsync.js","sourceRoot":"","sources":["../../../src/helpers/asyncArrayFunctions/filterAsync.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;GAOG;AACH,IAAM,WAAW,GAAG,UAClB,KAAU,EACV,gBAOiB;;;;;gBAGb,IAAI,GAAG,KAAK,CAAC;gBAKX,QAAQ,GAAG;oBACf,IAAI,GAAG,IAAI,CAAC;gBACd,CAAC,CAAC;gBAGI,MAAM,GAAQ,EAAE,CAAC;gBACd,CAAC,GAAG,CAAC;;;qBAAE,CAAA,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAA;gBACtB,qBAAM,gBAAgB,CACrC,KAAK,CAAC,CAAC,CAAC,EACR,CAAC,EACD;wBACE,QAAQ,UAAA;wBACR,KAAK,OAAA;qBACN,CACF,EAAA;;gBAPK,QAAQ,GAAG,SAOhB;gBACD,IAAI,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;oBACtB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACxB,CAAC;;;gBAXwC,CAAC,EAAE,CAAA;;;YAc9C,iBAAiB;YACjB,sBAAO,MAAM,EAAC;;;KACf,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var filterAsync_1 = __importDefault(require("./filterAsync"));
43
+ describe('filterAsync', function () {
44
+ it('should return an empty array when given an empty array', function () { return __awaiter(void 0, void 0, void 0, function () {
45
+ var result;
46
+ return __generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0: return [4 /*yield*/, (0, filterAsync_1.default)([], function () { return __awaiter(void 0, void 0, void 0, function () {
49
+ return __generator(this, function (_a) {
50
+ return [2 /*return*/, true];
51
+ });
52
+ }); })];
53
+ case 1:
54
+ result = _a.sent();
55
+ expect(result).toEqual([]);
56
+ return [2 /*return*/];
57
+ }
58
+ });
59
+ }); });
60
+ it('should return the original array when all items pass the filter', function () { return __awaiter(void 0, void 0, void 0, function () {
61
+ var originalArray, result;
62
+ return __generator(this, function (_a) {
63
+ switch (_a.label) {
64
+ case 0:
65
+ originalArray = [1, 2, 3];
66
+ return [4 /*yield*/, (0, filterAsync_1.default)(originalArray, function () { return __awaiter(void 0, void 0, void 0, function () {
67
+ return __generator(this, function (_a) {
68
+ return [2 /*return*/, true];
69
+ });
70
+ }); })];
71
+ case 1:
72
+ result = _a.sent();
73
+ expect(result).toEqual(originalArray);
74
+ return [2 /*return*/];
75
+ }
76
+ });
77
+ }); });
78
+ it('should return an empty array when no items pass the filter', function () { return __awaiter(void 0, void 0, void 0, function () {
79
+ var originalArray, result;
80
+ return __generator(this, function (_a) {
81
+ switch (_a.label) {
82
+ case 0:
83
+ originalArray = [1, 2, 3];
84
+ return [4 /*yield*/, (0, filterAsync_1.default)(originalArray, function () { return __awaiter(void 0, void 0, void 0, function () {
85
+ return __generator(this, function (_a) {
86
+ return [2 /*return*/, false];
87
+ });
88
+ }); })];
89
+ case 1:
90
+ result = _a.sent();
91
+ expect(result).toEqual([]);
92
+ return [2 /*return*/];
93
+ }
94
+ });
95
+ }); });
96
+ it('should return only the items that pass the filter', function () { return __awaiter(void 0, void 0, void 0, function () {
97
+ var originalArray, result;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0:
101
+ originalArray = [1, 2, 3];
102
+ return [4 /*yield*/, (0, filterAsync_1.default)(originalArray, function (item) { return __awaiter(void 0, void 0, void 0, function () {
103
+ return __generator(this, function (_a) {
104
+ return [2 /*return*/, item > 1];
105
+ });
106
+ }); })];
107
+ case 1:
108
+ result = _a.sent();
109
+ expect(result).toEqual([2, 3]);
110
+ return [2 /*return*/];
111
+ }
112
+ });
113
+ }); });
114
+ it('should pass the correct index to the operator function', function () { return __awaiter(void 0, void 0, void 0, function () {
115
+ var originalArray, result;
116
+ return __generator(this, function (_a) {
117
+ switch (_a.label) {
118
+ case 0:
119
+ originalArray = [1, 2, 3];
120
+ return [4 /*yield*/, (0, filterAsync_1.default)(originalArray, function (_, index) { return __awaiter(void 0, void 0, void 0, function () {
121
+ return __generator(this, function (_a) {
122
+ return [2 /*return*/, index === 1];
123
+ });
124
+ }); })];
125
+ case 1:
126
+ result = _a.sent();
127
+ expect(result).toEqual([2]);
128
+ return [2 /*return*/];
129
+ }
130
+ });
131
+ }); });
132
+ it('should allow breaking out of the loop early', function () { return __awaiter(void 0, void 0, void 0, function () {
133
+ var originalArray, result;
134
+ return __generator(this, function (_a) {
135
+ switch (_a.label) {
136
+ case 0:
137
+ originalArray = [1, 2, 3];
138
+ return [4 /*yield*/, (0, filterAsync_1.default)(originalArray, function (_1, index_1, _a) { return __awaiter(void 0, [_1, index_1, _a], void 0, function (_, index, _b) {
139
+ var breakNow = _b.breakNow;
140
+ return __generator(this, function (_c) {
141
+ if (index === 1) {
142
+ breakNow();
143
+ }
144
+ return [2 /*return*/, true];
145
+ });
146
+ }); })];
147
+ case 1:
148
+ result = _a.sent();
149
+ expect(result).toEqual([1]);
150
+ return [2 /*return*/];
151
+ }
152
+ });
153
+ }); });
154
+ it('should pass the original array to the operator function', function () { return __awaiter(void 0, void 0, void 0, function () {
155
+ var originalArray, result;
156
+ return __generator(this, function (_a) {
157
+ switch (_a.label) {
158
+ case 0:
159
+ originalArray = [1, 2, 3];
160
+ return [4 /*yield*/, (0, filterAsync_1.default)(originalArray, function (_1, index_1, _a) { return __awaiter(void 0, [_1, index_1, _a], void 0, function (_, index, _b) {
161
+ var array = _b.array;
162
+ return __generator(this, function (_c) {
163
+ return [2 /*return*/, array.length === 3];
164
+ });
165
+ }); })];
166
+ case 1:
167
+ result = _a.sent();
168
+ expect(result).toEqual(originalArray);
169
+ return [2 /*return*/];
170
+ }
171
+ });
172
+ }); });
173
+ it('should handle an operator function that returns a non-boolean value', function () { return __awaiter(void 0, void 0, void 0, function () {
174
+ var originalArray, result;
175
+ return __generator(this, function (_a) {
176
+ switch (_a.label) {
177
+ case 0:
178
+ originalArray = [1, 2, 3];
179
+ return [4 /*yield*/, (0, filterAsync_1.default)(originalArray, function () { return __awaiter(void 0, void 0, void 0, function () {
180
+ return __generator(this, function (_a) {
181
+ return [2 /*return*/, 'hello'];
182
+ });
183
+ }); })];
184
+ case 1:
185
+ result = _a.sent();
186
+ expect(result).toEqual(originalArray);
187
+ return [2 /*return*/];
188
+ }
189
+ });
190
+ }); });
191
+ it('should handle an operator function that throws an error', function () { return __awaiter(void 0, void 0, void 0, function () {
192
+ var originalArray, error, result, err_1;
193
+ return __generator(this, function (_a) {
194
+ switch (_a.label) {
195
+ case 0:
196
+ originalArray = [1, 2, 3];
197
+ error = null;
198
+ result = null;
199
+ _a.label = 1;
200
+ case 1:
201
+ _a.trys.push([1, 3, , 4]);
202
+ return [4 /*yield*/, (0, filterAsync_1.default)(originalArray, function () { return __awaiter(void 0, void 0, void 0, function () {
203
+ return __generator(this, function (_a) {
204
+ throw new Error('Something went wrong');
205
+ });
206
+ }); })];
207
+ case 2:
208
+ result = _a.sent();
209
+ return [3 /*break*/, 4];
210
+ case 3:
211
+ err_1 = _a.sent();
212
+ error = err_1;
213
+ return [3 /*break*/, 4];
214
+ case 4:
215
+ expect(result).toEqual(null);
216
+ expect(error).not.toBe(null);
217
+ return [2 /*return*/];
218
+ }
219
+ });
220
+ }); });
221
+ it('should handle an array of objects', function () { return __awaiter(void 0, void 0, void 0, function () {
222
+ var originalArray, result;
223
+ return __generator(this, function (_a) {
224
+ switch (_a.label) {
225
+ case 0:
226
+ originalArray = [
227
+ { name: 'Alice', age: 30 },
228
+ { name: 'Bob', age: 25 },
229
+ { name: 'Charlie', age: 35 },
230
+ ];
231
+ return [4 /*yield*/, (0, filterAsync_1.default)(originalArray, function (item) { return __awaiter(void 0, void 0, void 0, function () {
232
+ return __generator(this, function (_a) {
233
+ return [2 /*return*/, (item.age > 30)];
234
+ });
235
+ }); })];
236
+ case 1:
237
+ result = _a.sent();
238
+ expect(result).toEqual([{ name: 'Charlie', age: 35 }]);
239
+ return [2 /*return*/];
240
+ }
241
+ });
242
+ }); });
243
+ });
244
+ //# sourceMappingURL=filterAsync.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterAsync.test.js","sourceRoot":"","sources":["../../../src/helpers/asyncArrayFunctions/filterAsync.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAwC;AAExC,QAAQ,CAAC,aAAa,EAAE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MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;;;;SACxD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Run the operator function on each item in the array
3
+ * @author Gabe Abrams
4
+ * @param operatorFunction the operator function to apply
5
+ */
6
+ declare const forEachAsync: <T>(array: T[], operatorFunction: (item: T, index: number, opts: {
7
+ breakNow: () => void;
8
+ array: Array<T>;
9
+ }) => void) => Promise<void>;
10
+ export default forEachAsync;