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,104 @@
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 tasks in parallel with a limit on how many tasks can execute at once.
41
+ * No guarantees are made about the order of task execution
42
+ * @author Gabe Abrams
43
+ * @param taskFunctions functions that start asynchronous tasks and optionally
44
+ * resolve with values
45
+ * @param [limit=no limit] maximum number of asynchronous tasks to permit to run at
46
+ * once
47
+ * @returns array of resolved values in the same order as the task functions
48
+ */
49
+ var parallelLimit = function (taskFunctions, limit) { return __awaiter(void 0, void 0, void 0, function () {
50
+ var results;
51
+ return __generator(this, function (_a) {
52
+ switch (_a.label) {
53
+ case 0:
54
+ results = [];
55
+ // Wait until finished with all tasks
56
+ return [4 /*yield*/, new Promise(function (resolve) {
57
+ /* ------------- Helpers ------------ */
58
+ var nextTaskIndex = 0;
59
+ var numFinishedTasks = 0;
60
+ /**
61
+ * Start the next task
62
+ * @author Gabe Abrams
63
+ */
64
+ var startTask = function () { return __awaiter(void 0, void 0, void 0, function () {
65
+ var taskIndex, taskFunction, result;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ taskIndex = nextTaskIndex++;
70
+ taskFunction = taskFunctions[taskIndex];
71
+ if (!taskFunction) {
72
+ return [2 /*return*/];
73
+ }
74
+ return [4 /*yield*/, taskFunction()];
75
+ case 1:
76
+ result = _a.sent();
77
+ // Add results
78
+ results[taskIndex] = result;
79
+ // Tally and finish
80
+ if (++numFinishedTasks === taskFunctions.length) {
81
+ return [2 /*return*/, resolve()];
82
+ }
83
+ // Not finished! Start another task
84
+ startTask();
85
+ return [2 /*return*/];
86
+ }
87
+ });
88
+ }); };
89
+ /* ----------- Start Tasks ---------- */
90
+ // If no limit, start all tasks. At least start 1 task
91
+ var numTasks = Math.max((limit || taskFunctions.length), 1);
92
+ for (var i = 0; i < numTasks; i++) {
93
+ startTask();
94
+ }
95
+ })];
96
+ case 1:
97
+ // Wait until finished with all tasks
98
+ _a.sent();
99
+ return [2 /*return*/, results];
100
+ }
101
+ });
102
+ }); };
103
+ exports.default = parallelLimit;
104
+ //# sourceMappingURL=parallelLimit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelLimit.js","sourceRoot":"","sources":["../../src/helpers/parallelLimit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,IAAM,aAAa,GAAG,UACpB,aAAqC,EACrC,KAAc;;;;;gBAER,OAAO,GAAU,EAAE,CAAC;gBAE1B,qCAAqC;gBACrC,qBAAM,IAAI,OAAO,CAAO,UAAC,OAAO;wBAC9B,wCAAwC;wBAExC,IAAI,aAAa,GAAG,CAAC,CAAC;wBACtB,IAAI,gBAAgB,GAAG,CAAC,CAAC;wBACzB;;;2BAGG;wBACH,IAAM,SAAS,GAAG;;;;;wCACV,SAAS,GAAG,aAAa,EAAE,CAAC;wCAG5B,YAAY,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;wCAC9C,IAAI,CAAC,YAAY,EAAE,CAAC;4CAClB,sBAAO;wCACT,CAAC;wCAGc,qBAAM,YAAY,EAAE,EAAA;;wCAA7B,MAAM,GAAG,SAAoB;wCAEnC,cAAc;wCACd,OAAO,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;wCAE5B,mBAAmB;wCACnB,IAAI,EAAE,gBAAgB,KAAK,aAAa,CAAC,MAAM,EAAE,CAAC;4CAChD,sBAAO,OAAO,EAAE,EAAC;wCACnB,CAAC;wCAED,mCAAmC;wCACnC,SAAS,EAAE,CAAC;;;;6BACb,CAAC;wBAEF,wCAAwC;wBAExC,sDAAsD;wBACtD,IAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;wBAC9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;4BAClC,SAAS,EAAE,CAAC;wBACd,CAAC;oBACH,CAAC,CAAC,EAAA;;gBAzCF,qCAAqC;gBACrC,SAwCE,CAAC;gBAEH,sBAAO,OAAO,EAAC;;;KAChB,CAAC;AAEF,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Prefix a word or name with "a" or "an" depending on whether it starts with a
3
+ * vowel or not
4
+ * @author Gabe Abrams
5
+ * @param text the text to prefix
6
+ * @param capitalize whether to capitalize the "A" or "An"
7
+ * @returns the text prefixed with "a" or "an"
8
+ */
9
+ declare const prefixWithAOrAn: (text: string, capitalize?: boolean) => string;
10
+ export default prefixWithAOrAn;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Constants
4
+ var VOWELS = ['a', 'e', 'i', 'o', 'u'];
5
+ /**
6
+ * Prefix a word or name with "a" or "an" depending on whether it starts with a
7
+ * vowel or not
8
+ * @author Gabe Abrams
9
+ * @param text the text to prefix
10
+ * @param capitalize whether to capitalize the "A" or "An"
11
+ * @returns the text prefixed with "a" or "an"
12
+ */
13
+ var prefixWithAOrAn = function (text, capitalize) {
14
+ if (capitalize === void 0) { capitalize = false; }
15
+ // Get the first letter
16
+ var firstLetter = text.charAt(0).toLowerCase();
17
+ // Check if starts with vowel
18
+ var startsWithVowel = VOWELS.includes(firstLetter);
19
+ // Determine prefix
20
+ var prefix = startsWithVowel ? 'an' : 'a';
21
+ if (capitalize) {
22
+ prefix = prefix.charAt(0).toUpperCase() + prefix.substring(1);
23
+ }
24
+ // Return the text prefixed with "a" or "an"
25
+ return "".concat(prefix, " ").concat(text);
26
+ };
27
+ exports.default = prefixWithAOrAn;
28
+ //# sourceMappingURL=prefixWithAOrAn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefixWithAOrAn.js","sourceRoot":"","sources":["../../src/helpers/prefixWithAOrAn.ts"],"names":[],"mappings":";;AAAA,YAAY;AACZ,IAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEzC;;;;;;;GAOG;AACH,IAAM,eAAe,GAAG,UAAC,IAAY,EAAE,UAAkB;IAAlB,2BAAA,EAAA,kBAAkB;IACvD,uBAAuB;IACvB,IAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAEjD,6BAA6B;IAC7B,IAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAErD,mBAAmB;IACnB,IAAI,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1C,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,4CAA4C;IAC5C,OAAO,UAAG,MAAM,cAAI,IAAI,CAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Round a number to a certain number of decimals
3
+ * @author Gabe Abrams
4
+ * @param num the number to round
5
+ * @param numDecimals the number of decimals to round to
6
+ * @returns rounded number
7
+ */
8
+ declare const roundToNumDecimals: (num: number, numDecimals: number) => number;
9
+ export default roundToNumDecimals;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Round a number to a certain number of decimals
5
+ * @author Gabe Abrams
6
+ * @param num the number to round
7
+ * @param numDecimals the number of decimals to round to
8
+ * @returns rounded number
9
+ */
10
+ var roundToNumDecimals = function (num, numDecimals) {
11
+ var rounder = Math.pow(10, numDecimals);
12
+ return (Math.round(num * rounder) / rounder);
13
+ };
14
+ exports.default = roundToNumDecimals;
15
+ //# sourceMappingURL=roundToNumDecimals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToNumDecimals.js","sourceRoot":"","sources":["../../src/helpers/roundToNumDecimals.ts"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH,IAAM,kBAAkB,GAAG,UAAC,GAAW,EAAE,WAAmB;IAC1D,IAAM,OAAO,GAAG,SAAA,EAAE,EAAI,WAAW,CAAA,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shuffle a given array
3
+ * @author Austen Money
4
+ * @param arr the array to shuffle
5
+ * @returns the shuffled array
6
+ */
7
+ declare const shuffleArray: <T>(arr: T[]) => T[];
8
+ export default shuffleArray;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**
13
+ * Shuffle a given array
14
+ * @author Austen Money
15
+ * @param arr the array to shuffle
16
+ * @returns the shuffled array
17
+ */
18
+ var shuffleArray = function (arr) {
19
+ var _a;
20
+ var newArr = __spreadArray([], arr, true);
21
+ // Shuffle using Durstenfeld algorithm
22
+ for (var i = arr.length - 1; i > 0; i--) {
23
+ var j = Math.floor(Math.random() * (i + 1));
24
+ _a = [newArr[j], newArr[i]], newArr[i] = _a[0], newArr[j] = _a[1];
25
+ }
26
+ return newArr;
27
+ };
28
+ exports.default = shuffleArray;
29
+ //# sourceMappingURL=shuffleArray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shuffleArray.js","sourceRoot":"","sources":["../../src/helpers/shuffleArray.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;GAKG;AACH,IAAM,YAAY,GAAG,UAAI,GAAQ;;IAC/B,IAAM,MAAM,qBAAO,GAAG,OAAC,CAAC;IAExB,sCAAsC;IACtC,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,IAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,KAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAA9C,MAAM,CAAC,CAAC,CAAC,QAAA,EAAE,MAAM,CAAC,CAAC,CAAC,QAAA,CAA2B;IAClD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Start a dynamic wait, call the function once the operation has completed and
3
+ * the dynamic wait will continue waiting for the rest of the minimum time
4
+ * @author Gabe Abrams
5
+ * @param minWaitMs the minimum number of ms to wait
6
+ * @returns async function to call to finish the wait
7
+ */
8
+ declare const startMinWait: (minWaitMs: number) => () => Promise<void>;
9
+ export default startMinWait;
@@ -0,0 +1,79 @@
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 other helpers
43
+ var waitMs_1 = __importDefault(require("./waitMs"));
44
+ /**
45
+ * Start a dynamic wait, call the function once the operation has completed and
46
+ * the dynamic wait will continue waiting for the rest of the minimum time
47
+ * @author Gabe Abrams
48
+ * @param minWaitMs the minimum number of ms to wait
49
+ * @returns async function to call to finish the wait
50
+ */
51
+ var startMinWait = function (minWaitMs) {
52
+ var startTimestamp = Date.now();
53
+ /**
54
+ * Finish the remaining time to wait
55
+ * @author Gabe Abrams
56
+ */
57
+ return function () { return __awaiter(void 0, void 0, void 0, function () {
58
+ var endTimestamp, elapsedTimeMs, remainingTimeToWaitMs;
59
+ return __generator(this, function (_a) {
60
+ switch (_a.label) {
61
+ case 0:
62
+ endTimestamp = Date.now();
63
+ elapsedTimeMs = (endTimestamp - startTimestamp);
64
+ remainingTimeToWaitMs = minWaitMs - elapsedTimeMs;
65
+ if (remainingTimeToWaitMs <= 0) {
66
+ return [2 /*return*/];
67
+ }
68
+ // Perform wait
69
+ return [4 /*yield*/, (0, waitMs_1.default)(remainingTimeToWaitMs)];
70
+ case 1:
71
+ // Perform wait
72
+ _a.sent();
73
+ return [2 /*return*/];
74
+ }
75
+ });
76
+ }); };
77
+ };
78
+ exports.default = startMinWait;
79
+ //# sourceMappingURL=startMinWait.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startMinWait.js","sourceRoot":"","sources":["../../src/helpers/startMinWait.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAuB;AACvB,oDAA8B;AAE9B;;;;;;GAMG;AACH,IAAM,YAAY,GAAG,UAAC,SAAiB;IACrC,IAAM,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAElC;;;OAGG;IACH,OAAO;;;;;oBACC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;oBAG1B,aAAa,GAAG,CAAC,YAAY,GAAG,cAAc,CAAC,CAAC;oBAChD,qBAAqB,GAAG,SAAS,GAAG,aAAa,CAAC;oBACxD,IAAI,qBAAqB,IAAI,CAAC,EAAE,CAAC;wBAC/B,sBAAO;oBACT,CAAC;oBAED,eAAe;oBACf,qBAAM,IAAA,gBAAM,EAAC,qBAAqB,CAAC,EAAA;;oBADnC,eAAe;oBACf,SAAmC,CAAC;;;;SACrC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Create a human readable list from an array of strings.
3
+ * For example, ['apple', 'orange'] becomes "apple and orange"
4
+ * and ['apple', 'orange', 'mango'] becomes "apple, orange, and mango"
5
+ * @author Gabe Abrams
6
+ * @param items list of items in the list
7
+ * @returns human-readable list
8
+ */
9
+ declare const stringsToHumanReadableList: (items: string[]) => string;
10
+ export default stringsToHumanReadableList;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Create a human readable list from an array of strings.
5
+ * For example, ['apple', 'orange'] becomes "apple and orange"
6
+ * and ['apple', 'orange', 'mango'] becomes "apple, orange, and mango"
7
+ * @author Gabe Abrams
8
+ * @param items list of items in the list
9
+ * @returns human-readable list
10
+ */
11
+ var stringsToHumanReadableList = function (items) {
12
+ // Handle 0-item case
13
+ if (items.length === 0) {
14
+ return '';
15
+ }
16
+ // Handle 1-item case
17
+ if (items.length === 1) {
18
+ return items[0];
19
+ }
20
+ // Handle 2-item case
21
+ if (items.length === 2) {
22
+ return "".concat(items[0], " and ").concat(items[1]);
23
+ }
24
+ // Handle 3+ item case
25
+ var list = '';
26
+ items.forEach(function (item, i) {
27
+ if (i === items.length - 1) {
28
+ // Last item
29
+ list += ", and ".concat(item);
30
+ }
31
+ // Previous items
32
+ list += ", ".concat(item);
33
+ });
34
+ return list;
35
+ };
36
+ exports.default = stringsToHumanReadableList;
37
+ //# sourceMappingURL=stringsToHumanReadableList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringsToHumanReadableList.js","sourceRoot":"","sources":["../../src/helpers/stringsToHumanReadableList.ts"],"names":[],"mappings":";;AAAA;;;;;;;GAOG;AACH,IAAM,0BAA0B,GAAG,UAAC,KAAe;IACjD,qBAAqB;IACrB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,qBAAqB;IACrB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,qBAAqB;IACrB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,UAAG,KAAK,CAAC,CAAC,CAAC,kBAAQ,KAAK,CAAC,CAAC,CAAC,CAAE,CAAC;IACvC,CAAC;IAED,sBAAsB;IACtB,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,YAAY;YACZ,IAAI,IAAI,gBAAS,IAAI,CAAE,CAAC;QAC1B,CAAC;QAED,iBAAiB;QACjB,IAAI,IAAI,YAAK,IAAI,CAAE,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sum the numbers in an array
3
+ * @author Gabe Abrams
4
+ * @param nums the numbers to sum
5
+ * @returns the sum of the numbers
6
+ */
7
+ declare const sum: (nums: number[]) => number;
8
+ export default sum;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Sum the numbers in an array
5
+ * @author Gabe Abrams
6
+ * @param nums the numbers to sum
7
+ * @returns the sum of the numbers
8
+ */
9
+ var sum = function (nums) {
10
+ return nums.reduce(function (a, b) {
11
+ return (a + b);
12
+ }, 0);
13
+ };
14
+ exports.default = sum;
15
+ //# sourceMappingURL=sum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sum.js","sourceRoot":"","sources":["../../src/helpers/sum.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,IAAM,GAAG,GAAG,UAAC,IAAc;IACzB,OAAO,IAAI,CAAC,MAAM,CAChB,UAAC,CAAS,EAAE,CAAS;QACnB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACjB,CAAC,EACD,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This function converts a string to title case based on Chicago Title Case
3
+ * Style rules.
4
+ * @author Leisha Bhandari
5
+ * @param input: The input string that needs to be converted to Chicago title
6
+ * case.
7
+ * @returns Input string converted to title case
8
+ */
9
+ declare const chicagoTitleCase: (input: string) => string;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * This function converts a string to title case based on Chicago Title Case
3
+ * Style rules.
4
+ * @author Leisha Bhandari
5
+ * @param input: The input string that needs to be converted to Chicago title
6
+ * case.
7
+ * @returns Input string converted to title case
8
+ */
9
+ var chicagoTitleCase = function (input) {
10
+ // List of lowercase words according to Chicago Manual of Style
11
+ var lowerCaseWords = [
12
+ 'in', 'nor', 'of', 'on', 'or', 'as', 'at', 'but', 'by',
13
+ 'for', 'if', 'so', 'the', 'a', 'an', 'and', 'to', 'up',
14
+ 'yet'
15
+ ];
16
+ return input
17
+ // Converts given input string to lowercase
18
+ .toLowerCase()
19
+ // Splits the given string into separate words
20
+ .split(' ')
21
+ .map(function (word, index, words) {
22
+ // Capitalize the first word, last word, and the words that aren't
23
+ // in lowerCaseWords
24
+ return index === 0 || !lowerCaseWords.includes(word) || index === words.length - 1
25
+ ? "".concat(word.charAt(0).toUpperCase()).concat(word.slice(1)) // Capitalize the first letter
26
+ : word;
27
+ } // Nothing happens to the word
28
+ )
29
+ .join(' '); // Joins the words back
30
+ };
31
+ //# sourceMappingURL=ChicagoTitleCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChicagoTitleCase.js","sourceRoot":"","sources":["../../../src/helpers/validators/ChicagoTitleCase.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,IAAM,gBAAgB,GAAG,UAAC,KAAa;IACpC,+DAA+D;IAChE,IAAM,cAAc,GAAa;QAC/B,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI;QACtD,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI;QACtD,KAAK;KACN,CAAC;IAEF,OAAO,KAAK;QACV,2CAA2C;SAC1C,WAAW,EAAE;QACd,8CAA8C;SAC7C,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,UAAC,IAAI,EAAE,KAAK,EAAE,KAAK;QACtB,kEAAkE;QAClE,oBAAoB;QACpB,OAAA,KAAK,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC;YACzE,CAAC,CAAC,UAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,SAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,CAAC,8BAA8B;YAClF,CAAC,CAAC,IAAI;IAFR,CAEQ,CAAC,8BAA8B;KACxC;SACA,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,wBAAwB;AACxC,CAAC,CAAC"}
@@ -0,0 +1,79 @@
1
+ // Importing the testing function
2
+ // import chicagoTitleCase from './chicagoTitleCase';
3
+ // // Import constants
4
+ // import { INVALID_STRING_ERRORS, INVALID_REGEX_ERROR } from './shared/constants/ERROR_MESSAGES';
5
+ // /*------------------------------------------------------------------------*/
6
+ // /* ---------------------------- Valid Tests --------------------------- */
7
+ // /*------------------------------------------------------------------------*/
8
+ // const validTests: { input: string, expected: string }[] = [
9
+ // {
10
+ // input: 'this is the american language',
11
+ // expected: 'This the American language',
12
+ // },
13
+ // {
14
+ // input: 'to kill a mockingbird',
15
+ // expected: 'To Kill a Mockingbird',
16
+ // },
17
+ // {
18
+ // input: 'the lord of the rings',
19
+ // expected: 'The Lord of the Rings',
20
+ // },
21
+ // {
22
+ // input: 'pride and prejudice',
23
+ // expected: 'Pride and Prejudice',
24
+ // },
25
+ // {
26
+ // input: 'the road not taken',
27
+ // expected: 'The Road Not Taken',
28
+ // },
29
+ // ];
30
+ // test(
31
+ // 'Converts strings to Chicago title case correctly.',
32
+ // async () => {
33
+ // validTests.forEach(({ input, expected }) => {
34
+ // expect(chicagoTitleCase(input)).toBe(expected);
35
+ // });
36
+ // },
37
+ // );
38
+ // /*------------------------------------------------------------------------*/
39
+ // /* ---------------------------- Edge Cases ---------------------------- */
40
+ // /*------------------------------------------------------------------------*/
41
+ // const edgeCases: { input: string, expected: string }[] = [
42
+ // {
43
+ // input: 'x',
44
+ // expected: 'X',
45
+ // },
46
+ // {
47
+ // input: ' ',
48
+ // expected: ' ',
49
+ // },
50
+ // {
51
+ // input: '',
52
+ // expected: '',
53
+ // },
54
+ // {
55
+ // input: 'the',
56
+ // expected: 'The',
57
+ // },
58
+ // {
59
+ // input: 'THE ROAD NOT TAKEN',
60
+ // expected: 'The Road Not Taken',
61
+ // },
62
+ // {
63
+ // input: 'tO kiLL A mOckingBirD',
64
+ // expected: 'To Kill a Mockingbird',
65
+ // },
66
+ // {
67
+ // input: 'pRiDe And pReduJiCe',
68
+ // expected: 'Pride and Prejudice',
69
+ // },
70
+ // ];
71
+ // test(
72
+ // 'Handles the edge cases for the function that converts a string to Chicago Title Case.',
73
+ // async () => {
74
+ // edgeCases.forEach(({ input, expected }) => {
75
+ // expect(chicagoTitleCase(input)).toBe(expected);
76
+ // });
77
+ // },
78
+ // );
79
+ //# sourceMappingURL=ChicagoTitleCase.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChicagoTitleCase.test.js","sourceRoot":"","sources":["../../../src/helpers/validators/ChicagoTitleCase.test.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,qDAAqD;AAErD,sBAAsB;AACtB,kGAAkG;AAElG,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAE/E,8DAA8D;AAC9D,MAAM;AACN,8CAA8C;AAC9C,8CAA8C;AAC9C,OAAO;AACP,MAAM;AACN,sCAAsC;AACtC,yCAAyC;AACzC,OAAO;AACP,MAAM;AACN,sCAAsC;AACtC,yCAAyC;AACzC,OAAO;AACP,MAAM;AACN,oCAAoC;AACpC,uCAAuC;AACvC,OAAO;AACP,MAAM;AACN,mCAAmC;AACnC,sCAAsC;AACtC,OAAO;AACP,KAAK;AAEL,QAAQ;AACR,yDAAyD;AACzD,kBAAkB;AAClB,oDAAoD;AACpD,wDAAwD;AACxD,UAAU;AACV,OAAO;AACP,KAAK;AAEL,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAE/E,6DAA6D;AAC7D,MAAM;AACN,kBAAkB;AAClB,qBAAqB;AACrB,OAAO;AACP,MAAM;AACN,kBAAkB;AAClB,qBAAqB;AACrB,OAAO;AACP,MAAM;AACN,iBAAiB;AACjB,oBAAoB;AACpB,OAAO;AACP,MAAM;AACN,oBAAoB;AACpB,uBAAuB;AACvB,OAAO;AACP,MAAM;AACN,mCAAmC;AACnC,sCAAsC;AACtC,OAAO;AACP,MAAM;AACN,sCAAsC;AACtC,yCAAyC;AACzC,OAAO;AACP,MAAM;AACN,oCAAoC;AACpC,uCAAuC;AACvC,OAAO;AACP,KAAK;AAEL,QAAQ;AACR,6FAA6F;AAC7F,kBAAkB;AAClB,mDAAmD;AACnD,wDAAwD;AACxD,UAAU;AACV,OAAO;AACP,KAAK"}
File without changes
@@ -0,0 +1,39 @@
1
+ // /**
2
+ // * This function finds URLs within a given string and returns an array of
3
+ // * their locations.
4
+ // * @author Leisha Bhandari
5
+ // * @param block: The block of text to search for URLs
6
+ // * @returns Arrays where each of them contain the start and end index of the URL
7
+ // */
8
+ // function findURLs(block: string): { start: number, end: number }[] {
9
+ // // Expression representing the skeleton of a URL to help match and find the
10
+ // // URLs within the block of text (Also takes care of Unicode characters)
11
+ // const urlSkeleton = /(https?:\/\/[^\s\u0000-\u001F.,]+[^\s\u0000-\u001F.,]?(?:\?[^\s\u0000-\u001F]+)?(?:#[^\s\u0000-\u001F]+)?)/g;
12
+ // const found: { start: number, end: number }[] = [];
13
+ // let match: RegExpExecArray | null;
14
+ // // While loop to find the URLs in the given block of texts using the URL
15
+ // // skeleton
16
+ // while ((match === urlSkeleton.exec(block))
17
+ // && match !== null) {
18
+ // // To find the beginning index of the URL
19
+ // let start = match.index;
20
+ // // To find the last index of the URL
21
+ // let end = match.index + match[0].length;
22
+ // // If statements to check whether the URL is followed by some kind of
23
+ // // punctuation mark
24
+ // if (block.charAt(end) === '.' || /[,;:!?"]/.test(block.charAt(end))) {
25
+ // end--;
26
+ // }
27
+ // // While statement to make sure that the URL does not start with a
28
+ // // punctuation mark
29
+ // while (start > 0 && /[.,:;!?]/.test(block.charAt(start - 1))) {
30
+ // start--;
31
+ // }
32
+ // // The object with start and end index of the URL is found and pushed to
33
+ // // the found array
34
+ // found.push({ start, end });
35
+ // }
36
+ // // Returns the array of the found URLs location
37
+ // return found;
38
+ // }
39
+ //# sourceMappingURL=findURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findURL.js","sourceRoot":"","sources":["../../../src/helpers/validators/findURL.ts"],"names":[],"mappings":"AAAA,MAAM;AACN,6EAA6E;AAC7E,sBAAsB;AACtB,6BAA6B;AAC7B,wDAAwD;AACxD,mFAAmF;AACnF,MAAM;AACN,uEAAuE;AACvE,kFAAkF;AAClF,6EAA6E;AAC7E,uIAAuI;AACvI,wDAAwD;AACxD,uCAAuC;AAEvC,8EAA8E;AAC9E,gBAAgB;AAChB,gDAAgD;AAChD,gCAAgC;AAChC,gDAAgD;AAChD,+BAA+B;AAC/B,2CAA2C;AAC3C,+CAA+C;AAE/C,6EAA6E;AAC7E,0BAA0B;AAC1B,6EAA6E;AAC7E,eAAe;AACf,QAAQ;AAER,0EAA0E;AAC1E,0BAA0B;AAC1B,sEAAsE;AACtE,iBAAiB;AACjB,QAAQ;AAER,gFAAgF;AAChF,yBAAyB;AACzB,kCAAkC;AAClC,MAAM;AAEN,oDAAoD;AACpD,kBAAkB;AAClB,IAAI"}
File without changes