dce-reactkit 4.3.5-beta-progress-size.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. package/dist/cjs/index.js +405 -2374
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/LogReviewer.d.ts +1 -1
  4. package/dist/cjs/types/helpers/logClientEvent.d.ts +1 -1
  5. package/dist/cjs/types/html/genErrorPage.d.ts +1 -1
  6. package/dist/cjs/types/index.d.ts +2 -64
  7. package/dist/cjs/types/types/IntelliTableColumn.d.ts +1 -1
  8. package/dist/cjs/types/types/ProgressBarSize.d.ts +1 -0
  9. package/dist/esm/index.js +145 -2281
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/types/components/LogReviewer.d.ts +1 -1
  12. package/dist/esm/types/helpers/logClientEvent.d.ts +1 -1
  13. package/dist/esm/types/html/genErrorPage.d.ts +1 -1
  14. package/dist/esm/types/index.d.ts +2 -64
  15. package/dist/esm/types/types/IntelliTableColumn.d.ts +1 -1
  16. package/dist/esm/types/types/ProgressBarSize.d.ts +1 -0
  17. package/dist/index.d.ts +4 -835
  18. package/package.json +4 -3
  19. package/src/components/AppWrapper.tsx +12 -10
  20. package/src/components/AutoscrollToBottomContainer.tsx +5 -3
  21. package/src/components/CopiableBox.tsx +5 -1
  22. package/src/components/DBEntryManagerPanel/helpers/generateEndpointPath.ts +2 -2
  23. package/src/components/ErrorBox.tsx +6 -2
  24. package/src/components/IntelliTable.tsx +7 -5
  25. package/src/components/LogReviewer.tsx +23 -21
  26. package/src/components/Modal/index.tsx +5 -3
  27. package/src/components/MultiSwitch.tsx +5 -1
  28. package/src/components/ProgressBar.tsx +75 -61
  29. package/src/components/Shimmer.tsx +4 -2
  30. package/src/components/SimpleDateChooser.tsx +11 -13
  31. package/src/components/SimpleTimeChooser.tsx +4 -2
  32. package/src/helpers/canReviewLogs.test.ts +5 -3
  33. package/src/helpers/canReviewLogs.ts +5 -3
  34. package/src/helpers/initClient.tsx +8 -8
  35. package/src/helpers/isMobileOrTablet.tsx +2 -1
  36. package/src/helpers/isSelectAdmin.ts +4 -2
  37. package/src/helpers/logClientEvent.tsx +7 -5
  38. package/src/helpers/stubServerEndpoint.tsx +1 -1
  39. package/src/helpers/visitServerEndpoint.tsx +10 -7
  40. package/src/html/genErrorPage.ts +6 -4
  41. package/src/index.ts +105 -98
  42. package/src/types/IntelliTableColumn.ts +4 -1
  43. package/src/types/ProgressBarSize.ts +1 -0
  44. package/dist/cjs/types/constants/DAY_IN_MS.d.ts +0 -6
  45. package/dist/cjs/types/constants/HOUR_IN_MS.d.ts +0 -6
  46. package/dist/cjs/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +0 -6
  47. package/dist/cjs/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +0 -6
  48. package/dist/cjs/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +0 -7
  49. package/dist/cjs/types/constants/LOG_ROUTE_PATH.d.ts +0 -6
  50. package/dist/cjs/types/constants/MINUTE_IN_MS.d.ts +0 -6
  51. package/dist/cjs/types/constants/ROUTE_PATH_PREFIX.d.ts +0 -6
  52. package/dist/cjs/types/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +0 -6
  53. package/dist/cjs/types/errors/ErrorWithCode.d.ts +0 -9
  54. package/dist/cjs/types/helpers/abbreviate.d.ts +0 -10
  55. package/dist/cjs/types/helpers/abbreviate.test.d.ts +0 -5
  56. package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.d.ts +0 -13
  57. package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +0 -1
  58. package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.d.ts +0 -13
  59. package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +0 -1
  60. package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +0 -10
  61. package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +0 -1
  62. package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.d.ts +0 -11
  63. package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +0 -1
  64. package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.d.ts +0 -13
  65. package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +0 -1
  66. package/dist/cjs/types/helpers/avg.d.ts +0 -8
  67. package/dist/cjs/types/helpers/avg.test.d.ts +0 -5
  68. package/dist/cjs/types/helpers/capitalize.d.ts +0 -7
  69. package/dist/cjs/types/helpers/ceilToNumDecimals.d.ts +0 -9
  70. package/dist/cjs/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
  71. package/dist/cjs/types/helpers/cloneDeep.d.ts +0 -8
  72. package/dist/cjs/types/helpers/compareArraysByProp.d.ts +0 -13
  73. package/dist/cjs/types/helpers/compareArraysByProp.test.d.ts +0 -5
  74. package/dist/cjs/types/helpers/extractProp.d.ts +0 -12
  75. package/dist/cjs/types/helpers/extractProp.test.d.ts +0 -5
  76. package/dist/cjs/types/helpers/floorToNumDecimals.d.ts +0 -9
  77. package/dist/cjs/types/helpers/floorToNumDecimals.test.d.ts +0 -5
  78. package/dist/cjs/types/helpers/forceNumIntoBounds.d.ts +0 -10
  79. package/dist/cjs/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
  80. package/dist/cjs/types/helpers/genCSV.d.ts +0 -18
  81. package/dist/cjs/types/helpers/genCSV.test.d.ts +0 -5
  82. package/dist/cjs/types/helpers/genCommaList.d.ts +0 -12
  83. package/dist/cjs/types/helpers/genCommaList.test.d.ts +0 -1
  84. package/dist/cjs/types/helpers/getHumanReadableDate.d.ts +0 -8
  85. package/dist/cjs/types/helpers/getHumanReadableDate.test.d.ts +0 -5
  86. package/dist/cjs/types/helpers/getLocalTimeInfo.d.ts +0 -19
  87. package/dist/cjs/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
  88. package/dist/cjs/types/helpers/getMonthName.d.ts +0 -14
  89. package/dist/cjs/types/helpers/getMonthName.test.d.ts +0 -5
  90. package/dist/cjs/types/helpers/getOrdinal.d.ts +0 -8
  91. package/dist/cjs/types/helpers/getOrdinal.test.d.ts +0 -5
  92. package/dist/cjs/types/helpers/getPartOfDay.d.ts +0 -7
  93. package/dist/cjs/types/helpers/getPartOfDay.test.d.ts +0 -5
  94. package/dist/cjs/types/helpers/getTimeInfoInET.d.ts +0 -21
  95. package/dist/cjs/types/helpers/getTimeInfoInET.test.d.ts +0 -5
  96. package/dist/cjs/types/helpers/getTimestampFromTimeInfoInET.d.ts +0 -20
  97. package/dist/cjs/types/helpers/getWordCount.d.ts +0 -10
  98. package/dist/cjs/types/helpers/idify.d.ts +0 -9
  99. package/dist/cjs/types/helpers/onlyKeepLetters.d.ts +0 -8
  100. package/dist/cjs/types/helpers/padDecimalZeros.d.ts +0 -10
  101. package/dist/cjs/types/helpers/padZerosLeft.d.ts +0 -9
  102. package/dist/cjs/types/helpers/parallelLimit.d.ts +0 -12
  103. package/dist/cjs/types/helpers/prefixWithAOrAn.d.ts +0 -10
  104. package/dist/cjs/types/helpers/roundToNumDecimals.d.ts +0 -9
  105. package/dist/cjs/types/helpers/shuffleArray.d.ts +0 -8
  106. package/dist/cjs/types/helpers/startMinWait.d.ts +0 -9
  107. package/dist/cjs/types/helpers/stringsToHumanReadableList.d.ts +0 -10
  108. package/dist/cjs/types/helpers/sum.d.ts +0 -8
  109. package/dist/cjs/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
  110. package/dist/cjs/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
  111. package/dist/cjs/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
  112. package/dist/cjs/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
  113. package/dist/cjs/types/helpers/validators/validURL.d.ts +0 -8
  114. package/dist/cjs/types/helpers/validators/validateEmail.d.ts +0 -11
  115. package/dist/cjs/types/helpers/validators/validateEmail.test.d.ts +0 -1
  116. package/dist/cjs/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
  117. package/dist/cjs/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
  118. package/dist/cjs/types/helpers/validators/validateString.d.ts +0 -22
  119. package/dist/cjs/types/helpers/validators/validateString.test.d.ts +0 -1
  120. package/dist/cjs/types/helpers/waitMs.d.ts +0 -7
  121. package/dist/cjs/types/types/DayOfWeek.d.ts +0 -14
  122. package/dist/cjs/types/types/Log/LogMainInfo.d.ts +0 -39
  123. package/dist/cjs/types/types/Log/LogSourceSpecificInfo.d.ts +0 -13
  124. package/dist/cjs/types/types/Log/LogTypeSpecificInfo.d.ts +0 -17
  125. package/dist/cjs/types/types/Log/index.d.ts +0 -10
  126. package/dist/cjs/types/types/LogAction.d.ts +0 -29
  127. package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +0 -16
  128. package/dist/cjs/types/types/LogFunction.d.ts +0 -24
  129. package/dist/cjs/types/types/LogLevel.d.ts +0 -10
  130. package/dist/cjs/types/types/LogMetadataContextMap.d.ts +0 -11
  131. package/dist/cjs/types/types/LogMetadataTagMap.d.ts +0 -8
  132. package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +0 -8
  133. package/dist/cjs/types/types/LogMetadataType.d.ts +0 -13
  134. package/dist/cjs/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +0 -17
  135. package/dist/cjs/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +0 -21
  136. package/dist/cjs/types/types/LogReviewerFilterState/ContextFilterState.d.ts +0 -10
  137. package/dist/cjs/types/types/LogReviewerFilterState/DateFilterState.d.ts +0 -17
  138. package/dist/cjs/types/types/LogReviewerFilterState/TagFilterState.d.ts +0 -8
  139. package/dist/cjs/types/types/LogReviewerFilterState/index.d.ts +0 -17
  140. package/dist/cjs/types/types/LogSource.d.ts +0 -9
  141. package/dist/cjs/types/types/LogType.d.ts +0 -9
  142. package/dist/cjs/types/types/ParamType.d.ts +0 -17
  143. package/dist/cjs/types/types/ReactKitErrorCode.d.ts +0 -14
  144. package/dist/esm/types/constants/DAY_IN_MS.d.ts +0 -6
  145. package/dist/esm/types/constants/HOUR_IN_MS.d.ts +0 -6
  146. package/dist/esm/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +0 -6
  147. package/dist/esm/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +0 -6
  148. package/dist/esm/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +0 -7
  149. package/dist/esm/types/constants/LOG_ROUTE_PATH.d.ts +0 -6
  150. package/dist/esm/types/constants/MINUTE_IN_MS.d.ts +0 -6
  151. package/dist/esm/types/constants/ROUTE_PATH_PREFIX.d.ts +0 -6
  152. package/dist/esm/types/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +0 -6
  153. package/dist/esm/types/errors/ErrorWithCode.d.ts +0 -9
  154. package/dist/esm/types/helpers/abbreviate.d.ts +0 -10
  155. package/dist/esm/types/helpers/abbreviate.test.d.ts +0 -5
  156. package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.d.ts +0 -13
  157. package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +0 -1
  158. package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.d.ts +0 -13
  159. package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +0 -1
  160. package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +0 -10
  161. package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +0 -1
  162. package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.d.ts +0 -11
  163. package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +0 -1
  164. package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.d.ts +0 -13
  165. package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +0 -1
  166. package/dist/esm/types/helpers/avg.d.ts +0 -8
  167. package/dist/esm/types/helpers/avg.test.d.ts +0 -5
  168. package/dist/esm/types/helpers/capitalize.d.ts +0 -7
  169. package/dist/esm/types/helpers/ceilToNumDecimals.d.ts +0 -9
  170. package/dist/esm/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
  171. package/dist/esm/types/helpers/cloneDeep.d.ts +0 -8
  172. package/dist/esm/types/helpers/compareArraysByProp.d.ts +0 -13
  173. package/dist/esm/types/helpers/compareArraysByProp.test.d.ts +0 -5
  174. package/dist/esm/types/helpers/extractProp.d.ts +0 -12
  175. package/dist/esm/types/helpers/extractProp.test.d.ts +0 -5
  176. package/dist/esm/types/helpers/floorToNumDecimals.d.ts +0 -9
  177. package/dist/esm/types/helpers/floorToNumDecimals.test.d.ts +0 -5
  178. package/dist/esm/types/helpers/forceNumIntoBounds.d.ts +0 -10
  179. package/dist/esm/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
  180. package/dist/esm/types/helpers/genCSV.d.ts +0 -18
  181. package/dist/esm/types/helpers/genCSV.test.d.ts +0 -5
  182. package/dist/esm/types/helpers/genCommaList.d.ts +0 -12
  183. package/dist/esm/types/helpers/genCommaList.test.d.ts +0 -1
  184. package/dist/esm/types/helpers/getHumanReadableDate.d.ts +0 -8
  185. package/dist/esm/types/helpers/getHumanReadableDate.test.d.ts +0 -5
  186. package/dist/esm/types/helpers/getLocalTimeInfo.d.ts +0 -19
  187. package/dist/esm/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
  188. package/dist/esm/types/helpers/getMonthName.d.ts +0 -14
  189. package/dist/esm/types/helpers/getMonthName.test.d.ts +0 -5
  190. package/dist/esm/types/helpers/getOrdinal.d.ts +0 -8
  191. package/dist/esm/types/helpers/getOrdinal.test.d.ts +0 -5
  192. package/dist/esm/types/helpers/getPartOfDay.d.ts +0 -7
  193. package/dist/esm/types/helpers/getPartOfDay.test.d.ts +0 -5
  194. package/dist/esm/types/helpers/getTimeInfoInET.d.ts +0 -21
  195. package/dist/esm/types/helpers/getTimeInfoInET.test.d.ts +0 -5
  196. package/dist/esm/types/helpers/getTimestampFromTimeInfoInET.d.ts +0 -20
  197. package/dist/esm/types/helpers/getWordCount.d.ts +0 -10
  198. package/dist/esm/types/helpers/idify.d.ts +0 -9
  199. package/dist/esm/types/helpers/onlyKeepLetters.d.ts +0 -8
  200. package/dist/esm/types/helpers/padDecimalZeros.d.ts +0 -10
  201. package/dist/esm/types/helpers/padZerosLeft.d.ts +0 -9
  202. package/dist/esm/types/helpers/parallelLimit.d.ts +0 -12
  203. package/dist/esm/types/helpers/prefixWithAOrAn.d.ts +0 -10
  204. package/dist/esm/types/helpers/roundToNumDecimals.d.ts +0 -9
  205. package/dist/esm/types/helpers/shuffleArray.d.ts +0 -8
  206. package/dist/esm/types/helpers/startMinWait.d.ts +0 -9
  207. package/dist/esm/types/helpers/stringsToHumanReadableList.d.ts +0 -10
  208. package/dist/esm/types/helpers/sum.d.ts +0 -8
  209. package/dist/esm/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
  210. package/dist/esm/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
  211. package/dist/esm/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
  212. package/dist/esm/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
  213. package/dist/esm/types/helpers/validators/validURL.d.ts +0 -8
  214. package/dist/esm/types/helpers/validators/validateEmail.d.ts +0 -11
  215. package/dist/esm/types/helpers/validators/validateEmail.test.d.ts +0 -1
  216. package/dist/esm/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
  217. package/dist/esm/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
  218. package/dist/esm/types/helpers/validators/validateString.d.ts +0 -22
  219. package/dist/esm/types/helpers/validators/validateString.test.d.ts +0 -1
  220. package/dist/esm/types/helpers/waitMs.d.ts +0 -7
  221. package/dist/esm/types/types/DayOfWeek.d.ts +0 -14
  222. package/dist/esm/types/types/Log/LogMainInfo.d.ts +0 -39
  223. package/dist/esm/types/types/Log/LogSourceSpecificInfo.d.ts +0 -13
  224. package/dist/esm/types/types/Log/LogTypeSpecificInfo.d.ts +0 -17
  225. package/dist/esm/types/types/Log/index.d.ts +0 -10
  226. package/dist/esm/types/types/LogAction.d.ts +0 -29
  227. package/dist/esm/types/types/LogBuiltInMetadata.d.ts +0 -16
  228. package/dist/esm/types/types/LogFunction.d.ts +0 -24
  229. package/dist/esm/types/types/LogLevel.d.ts +0 -10
  230. package/dist/esm/types/types/LogMetadataContextMap.d.ts +0 -11
  231. package/dist/esm/types/types/LogMetadataTagMap.d.ts +0 -8
  232. package/dist/esm/types/types/LogMetadataTargetMap.d.ts +0 -8
  233. package/dist/esm/types/types/LogMetadataType.d.ts +0 -13
  234. package/dist/esm/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +0 -17
  235. package/dist/esm/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +0 -21
  236. package/dist/esm/types/types/LogReviewerFilterState/ContextFilterState.d.ts +0 -10
  237. package/dist/esm/types/types/LogReviewerFilterState/DateFilterState.d.ts +0 -17
  238. package/dist/esm/types/types/LogReviewerFilterState/TagFilterState.d.ts +0 -8
  239. package/dist/esm/types/types/LogReviewerFilterState/index.d.ts +0 -17
  240. package/dist/esm/types/types/LogSource.d.ts +0 -9
  241. package/dist/esm/types/types/LogType.d.ts +0 -9
  242. package/dist/esm/types/types/ParamType.d.ts +0 -17
  243. package/dist/esm/types/types/ReactKitErrorCode.d.ts +0 -14
  244. package/src/constants/DAY_IN_MS.ts +0 -7
  245. package/src/constants/HOUR_IN_MS.ts +0 -7
  246. package/src/constants/LOG_REVIEW_GET_LOGS_ROUTE.ts +0 -9
  247. package/src/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.ts +0 -9
  248. package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +0 -10
  249. package/src/constants/LOG_ROUTE_PATH.ts +0 -9
  250. package/src/constants/MINUTE_IN_MS.ts +0 -7
  251. package/src/constants/ROUTE_PATH_PREFIX.ts +0 -7
  252. package/src/constants/SELECT_ADMIN_CHECK_ROUTE.ts +0 -7
  253. package/src/errors/ErrorWithCode.tsx +0 -15
  254. package/src/helpers/abbreviate.test.ts +0 -26
  255. package/src/helpers/abbreviate.ts +0 -25
  256. package/src/helpers/asyncArrayFunctions/everyAsync.test.ts +0 -114
  257. package/src/helpers/asyncArrayFunctions/everyAsync.ts +0 -51
  258. package/src/helpers/asyncArrayFunctions/filterAsync.test.ts +0 -126
  259. package/src/helpers/asyncArrayFunctions/filterAsync.ts +0 -50
  260. package/src/helpers/asyncArrayFunctions/forEachAsync.test.ts +0 -136
  261. package/src/helpers/asyncArrayFunctions/forEachAsync.ts +0 -40
  262. package/src/helpers/asyncArrayFunctions/mapAsync.test.ts +0 -125
  263. package/src/helpers/asyncArrayFunctions/mapAsync.ts +0 -46
  264. package/src/helpers/asyncArrayFunctions/someAsync.test.ts +0 -92
  265. package/src/helpers/asyncArrayFunctions/someAsync.ts +0 -49
  266. package/src/helpers/avg.test.ts +0 -24
  267. package/src/helpers/avg.ts +0 -22
  268. package/src/helpers/capitalize.ts +0 -20
  269. package/src/helpers/ceilToNumDecimals.test.ts +0 -39
  270. package/src/helpers/ceilToNumDecimals.ts +0 -13
  271. package/src/helpers/cloneDeep.ts +0 -11
  272. package/src/helpers/compareArraysByProp.test.ts +0 -147
  273. package/src/helpers/compareArraysByProp.ts +0 -56
  274. package/src/helpers/extractProp.test.ts +0 -34
  275. package/src/helpers/extractProp.ts +0 -17
  276. package/src/helpers/floorToNumDecimals.test.ts +0 -39
  277. package/src/helpers/floorToNumDecimals.ts +0 -13
  278. package/src/helpers/forceNumIntoBounds.test.ts +0 -34
  279. package/src/helpers/forceNumIntoBounds.ts +0 -19
  280. package/src/helpers/genCSV.test.ts +0 -75
  281. package/src/helpers/genCSV.ts +0 -87
  282. package/src/helpers/genCommaList.test.ts +0 -57
  283. package/src/helpers/genCommaList.ts +0 -21
  284. package/src/helpers/getHumanReadableDate.test.ts +0 -29
  285. package/src/helpers/getHumanReadableDate.ts +0 -36
  286. package/src/helpers/getLocalTimeInfo.test.ts +0 -48
  287. package/src/helpers/getLocalTimeInfo.ts +0 -58
  288. package/src/helpers/getMonthName.test.ts +0 -79
  289. package/src/helpers/getMonthName.ts +0 -29
  290. package/src/helpers/getOrdinal.test.ts +0 -84
  291. package/src/helpers/getOrdinal.ts +0 -14
  292. package/src/helpers/getPartOfDay.test.ts +0 -56
  293. package/src/helpers/getPartOfDay.ts +0 -20
  294. package/src/helpers/getTimeInfoInET.test.ts +0 -72
  295. package/src/helpers/getTimeInfoInET.ts +0 -79
  296. package/src/helpers/getTimestampFromTimeInfoInET.ts +0 -179
  297. package/src/helpers/getWordCount.ts +0 -26
  298. package/src/helpers/idify.ts +0 -24
  299. package/src/helpers/onlyKeepLetters.ts +0 -11
  300. package/src/helpers/padDecimalZeros.tsx +0 -32
  301. package/src/helpers/padZerosLeft.tsx +0 -21
  302. package/src/helpers/parallelLimit.ts +0 -76
  303. package/src/helpers/prefixWithAOrAn.ts +0 -29
  304. package/src/helpers/roundToNumDecimals.tsx +0 -13
  305. package/src/helpers/shuffleArray.ts +0 -19
  306. package/src/helpers/startMinWait.ts +0 -33
  307. package/src/helpers/stringsToHumanReadableList.ts +0 -39
  308. package/src/helpers/sum.tsx +0 -16
  309. package/src/helpers/validators/ChicagoTitleCase.test.ts +0 -85
  310. package/src/helpers/validators/ChicagoTitleCase.ts +0 -32
  311. package/src/helpers/validators/findURL.test.ts +0 -83
  312. package/src/helpers/validators/findURL.ts +0 -43
  313. package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +0 -18
  314. package/src/helpers/validators/shared/helpers/validateRegex.ts +0 -47
  315. package/src/helpers/validators/shared/types/ValidationResult.ts +0 -20
  316. package/src/helpers/validators/validURL.test.ts +0 -90
  317. package/src/helpers/validators/validURL.ts +0 -18
  318. package/src/helpers/validators/validateEmail.test.ts +0 -110
  319. package/src/helpers/validators/validateEmail.ts +0 -47
  320. package/src/helpers/validators/validatePhoneNumber.test.ts +0 -94
  321. package/src/helpers/validators/validatePhoneNumber.ts +0 -49
  322. package/src/helpers/validators/validateString.test.ts +0 -173
  323. package/src/helpers/validators/validateString.ts +0 -171
  324. package/src/helpers/waitMs.tsx +0 -12
  325. package/src/types/DayOfWeek.ts +0 -15
  326. package/src/types/Log/LogMainInfo.ts +0 -69
  327. package/src/types/Log/LogSourceSpecificInfo.ts +0 -25
  328. package/src/types/Log/LogTypeSpecificInfo.ts +0 -33
  329. package/src/types/Log/index.ts +0 -17
  330. package/src/types/LogAction.ts +0 -52
  331. package/src/types/LogBuiltInMetadata.ts +0 -19
  332. package/src/types/LogFunction.ts +0 -46
  333. package/src/types/LogLevel.ts +0 -11
  334. package/src/types/LogMetadataContextMap.ts +0 -15
  335. package/src/types/LogMetadataTagMap.ts +0 -9
  336. package/src/types/LogMetadataTargetMap.ts +0 -9
  337. package/src/types/LogMetadataType.ts +0 -16
  338. package/src/types/LogReviewerFilterState/ActionErrorFilterState.ts +0 -24
  339. package/src/types/LogReviewerFilterState/AdvancedFilterState.ts +0 -36
  340. package/src/types/LogReviewerFilterState/ContextFilterState.ts +0 -16
  341. package/src/types/LogReviewerFilterState/DateFilterState.ts +0 -26
  342. package/src/types/LogReviewerFilterState/TagFilterState.ts +0 -9
  343. package/src/types/LogReviewerFilterState/index.ts +0 -24
  344. package/src/types/LogSource.ts +0 -12
  345. package/src/types/LogType.ts +0 -12
  346. package/src/types/ParamType.ts +0 -18
  347. package/src/types/ReactKitErrorCode.tsx +0 -17
@@ -1,179 +0,0 @@
1
- // Import shared types
2
- import ErrorWithCode from '../errors/ErrorWithCode';
3
- import ReactKitErrorCode from '../types/ReactKitErrorCode';
4
-
5
- // Import shared helpers
6
- import getTimeInfoInET from './getTimeInfoInET';
7
- import padZerosLeft from './padZerosLeft';
8
-
9
- /*----------------------------------------*/
10
- /* --------------- Helpers -------------- */
11
- /*----------------------------------------*/
12
-
13
- /**
14
- * Check if a timestamp is valid
15
- * @author Gabe Abrams
16
- * @author Gardenia Liu
17
- * @param opts object containing all arguments
18
- * @param opts.timestamp Timestamp in milliseconds since epoch
19
- * @param opts.expectedYear Expected year
20
- * @param opts.expectedMonth Expected month
21
- * @param opts.expectedDay Expected day
22
- * @param opts.expectedHour Expected hour
23
- * @param opts.expectedMinute Expected minute
24
- * @returns 1 if the timestamp needs to be increased, -1 if it needs to be decreased, 0 if it is valid
25
- */
26
- const checkTimestamp = (
27
- opts: {
28
- timestamp: number,
29
- expectedYear: number,
30
- expectedMonth: number,
31
- expectedDay: number,
32
- expectedHour: number,
33
- expectedMinute: number,
34
- },
35
- ): number => {
36
- const {
37
- timestamp,
38
- expectedYear,
39
- expectedMonth,
40
- expectedDay,
41
- expectedHour,
42
- expectedMinute,
43
- } = opts;
44
-
45
- const timeInfoInET = getTimeInfoInET(timestamp);
46
- if (timeInfoInET.year < expectedYear) {
47
- return 1;
48
- }
49
- if (timeInfoInET.year > expectedYear) {
50
- return -1;
51
- }
52
- if (timeInfoInET.month < expectedMonth) {
53
- return 1;
54
- }
55
- if (timeInfoInET.month > expectedMonth) {
56
- return -1;
57
- }
58
- if (timeInfoInET.day < expectedDay) {
59
- return 1;
60
- }
61
- if (timeInfoInET.day > expectedDay) {
62
- return -1;
63
- }
64
- if (timeInfoInET.hour < expectedHour) {
65
- return 1;
66
- }
67
- if (timeInfoInET.hour > expectedHour) {
68
- return -1;
69
- }
70
- if (timeInfoInET.minute < expectedMinute) {
71
- return 1;
72
- }
73
- if (timeInfoInET.minute > expectedMinute) {
74
- return -1;
75
- }
76
- return 0;
77
- };
78
-
79
- /*----------------------------------------*/
80
- /* ---------------- Main ---------------- */
81
- /*----------------------------------------*/
82
-
83
- /**
84
- * Get a timestamp (ms since epoch) from time info (year, month, day, hour, minute, etc.) in Eastern Time (ET)
85
- * @author Gardenia Liu
86
- * @author Gabe Abrams
87
- * @param opts object containing all arguments
88
- * @param opts.year Year (e.g. 2023)
89
- * @param opts.month Month (1-12)
90
- * @param opts.day Day of the month (1-31)
91
- * @param opts.hour Hour (0-23)
92
- * @param opts.minute Minute (0-59)
93
- * @returns Timestamp in milliseconds since epoch
94
- */
95
- const getTimestampFromTimeInfoInET = (
96
- opts: {
97
- year: number,
98
- month: number,
99
- day: number,
100
- hour: number,
101
- minute: number,
102
- },
103
- ): number => {
104
- // Destructure opts
105
- const {
106
- year,
107
- month,
108
- day,
109
- hour,
110
- minute,
111
- } = opts;
112
-
113
- // Determine if the date is in DST in Eastern Time
114
- const tempDate = new Date(year, month - 1, day);
115
- const janOffset = new Date(year, 0, 1).getTimezoneOffset();
116
- const isDST = tempDate.getTimezoneOffset() < janOffset;
117
- const etOffset = isDST ? '-04:00' : '-05:00';
118
-
119
- // Format with leading zeroes
120
- const mm = padZerosLeft(month, 2);
121
- const dd = padZerosLeft(day, 2);
122
- const hh = padZerosLeft(hour, 2);
123
- const min = padZerosLeft(minute, 2);
124
-
125
- // Build ET ISO string and convert to UTC timestamp
126
- const etISOString = `${year}-${mm}-${dd}T${hh}:${min}:00${etOffset}`;
127
- const baseTimestamp = (new Date(etISOString)).getTime();
128
- let timestamp = baseTimestamp;
129
-
130
- // Heat seek to get the right timestamp
131
- const maxOffset = 24 * 60; // 24 hours in minutes
132
- let currentOffset = 0; // minutes
133
- const offsetIncrement = 15; // minutes
134
- const offsetDirection = checkTimestamp({
135
- timestamp,
136
- expectedYear: year,
137
- expectedMonth: month,
138
- expectedDay: day,
139
- expectedHour: hour,
140
- expectedMinute: minute,
141
- });
142
- if (offsetDirection === 0) {
143
- // Valid! Return the timestamp
144
- return timestamp;
145
- }
146
-
147
- // Heat seek
148
- while (Math.abs(currentOffset) < maxOffset) {
149
- // Update offset
150
- currentOffset += (offsetDirection * offsetIncrement);
151
-
152
- // Update timestamp
153
- const offsetMs = currentOffset * 60 * 1000;
154
- timestamp = baseTimestamp + offsetMs;
155
-
156
- // Check timestamp again
157
- const newDirection = checkTimestamp({
158
- timestamp,
159
- expectedYear: year,
160
- expectedMonth: month,
161
- expectedDay: day,
162
- expectedHour: hour,
163
- expectedMinute: minute,
164
- });
165
- if (newDirection === 0) {
166
- // Valid! Return the timestamp
167
- return timestamp;
168
- }
169
-
170
- // Invalid. Keep looping.
171
- }
172
-
173
- throw new ErrorWithCode(
174
- `Timestamp mismatch: expected ${year}-${mm}-${dd} ${hh}:${min}, seeked to offset ${currentOffset} minutes but could not find a valid timestamp.`,
175
- ReactKitErrorCode.ETTimestampInvalid,
176
- );
177
- };
178
-
179
- export default getTimestampFromTimeInfoInET;
@@ -1,26 +0,0 @@
1
- const punctuationRegex = /[!@#$%^&*(),.?\/;:'"\-\[\]]/g;
2
-
3
- /**
4
- * Get number of words in string
5
- * @author Gardenia Liu
6
- * @author Allison Zhang
7
- * @author Gabe Abrams
8
- * @param text the string to check
9
- * @returns number of words in the string
10
- */
11
- const getWordCount = (text: string): number => {
12
- const trimmedTextWithoutPunctuation = (
13
- text
14
- // Remove leading and trailing whitespace
15
- .trim()
16
- // Remove punctuation
17
- .replace(punctuationRegex, '')
18
- );
19
- if (trimmedTextWithoutPunctuation.length === 0) {
20
- return 0;
21
- }
22
-
23
- return trimmedTextWithoutPunctuation.split(/\s+/g).length;
24
- };
25
-
26
- export default getWordCount;
@@ -1,24 +0,0 @@
1
- /**
2
- * Convert a string to hyphenated lowercase format with no space or
3
- * non-alphanumeric characters
4
- * @author Gabe Abrams
5
- * @param str the string to convert
6
- * @returns the idified string
7
- */
8
- const idify = (str: string): string => {
9
- return (
10
- str
11
- // Trim whitespace
12
- .trim()
13
- // Convert to lowercase
14
- .toLowerCase()
15
- // Replace non-alphanumeric characters with hyphens
16
- .replace(/[^a-z0-9]+/g, '-')
17
- // Change multiple hyphens in a row for a single hyphen
18
- .replace(/-+/g, '-')
19
- // Remove hyphens at the beginning and end of the string
20
- .replace(/^-+|-+$/g, '')
21
- );
22
- };
23
-
24
- export default idify;
@@ -1,11 +0,0 @@
1
- /**
2
- * Given a string, only keep the letters inside it
3
- * @author Gabe Abrams
4
- * @param str the string to parse
5
- * @returns only the letters inside of the string
6
- */
7
- const onlyKeepLetters = (str: string): string => {
8
- return str.replace(/[^a-zA-Z]+/g, '');
9
- };
10
-
11
- export default onlyKeepLetters;
@@ -1,32 +0,0 @@
1
- /**
2
- * Pad a number's decimal with zeros on the right
3
- * (e.g. 5.2 becomes 5.20 with 2 digit padding)
4
- * @author Gabe Abrams
5
- * @param num the number to pad
6
- * @param numDigits the minimum number of digits after the decimal
7
- * @returns padded number
8
- */
9
- const padDecimalZeros = (num: number, numDigits: number): string => {
10
- // Skip if nothing to do
11
- if (numDigits < 1) {
12
- return String(num);
13
- }
14
-
15
- // Convert to string
16
- let out = String(num);
17
-
18
- // Add a decimal point if there isn't one
19
- if (!out.includes('.')) {
20
- out += '.';
21
- }
22
-
23
- // Add zeros
24
- while (out.split('.')[1].length < numDigits) {
25
- out = `${out}0`;
26
- }
27
-
28
- // Return
29
- return out;
30
- };
31
-
32
- export default padDecimalZeros;
@@ -1,21 +0,0 @@
1
- /**
2
- * Pad a number with zeros on the left (e.g. 5 becomes 05 with 2 digit padding)
3
- * @author Gabe Abrams
4
- * @param num the number to pad
5
- * @param numDigits the minimum number of digits before the decimal
6
- * @returns padded number
7
- */
8
- const padZerosLeft = (num: number, numDigits: number): string => {
9
- // Convert to string
10
- let out = String(num);
11
-
12
- // Add zeros
13
- while (out.split('.')[0].length < numDigits) {
14
- out = `0${out}`;
15
- }
16
-
17
- // Return
18
- return out;
19
- };
20
-
21
- export default padZerosLeft;
@@ -1,76 +0,0 @@
1
- /**
2
- * Run tasks in parallel with a limit on how many tasks can execute at once.
3
- * No guarantees are made about the order of task execution
4
- * @author Gabe Abrams
5
- * @param taskFunctions functions that start asynchronous tasks and optionally
6
- * resolve with values
7
- * @param [limit=no limit] maximum number of asynchronous tasks to permit to run at
8
- * once
9
- * @returns array of resolved values in the same order as the task functions
10
- */
11
- const parallelLimit = async (
12
- taskFunctions: (() => Promise<any>)[],
13
- limit?: number,
14
- ): Promise<any[]> => {
15
- const results: any[] = [];
16
-
17
- let exited = false;
18
-
19
- // Wait until finished with all tasks
20
- await new Promise<void>((resolve, reject) => {
21
- /* ------------- Helpers ------------ */
22
-
23
- let nextTaskIndex = 0;
24
- let numFinishedTasks = 0;
25
- /**
26
- * Start the next task
27
- * @author Gabe Abrams
28
- */
29
- const startTask = async () => {
30
- const taskIndex = nextTaskIndex++;
31
-
32
- // Get the task
33
- const taskFunction = taskFunctions[taskIndex];
34
- if (!taskFunction) {
35
- return;
36
- }
37
-
38
- try {
39
- // Execute task
40
- const result = await taskFunction();
41
-
42
- // Add results
43
- results[taskIndex] = result;
44
-
45
- // Tally and finish
46
- if (++numFinishedTasks === taskFunctions.length) {
47
- exited = true;
48
- return resolve();
49
- }
50
-
51
- if (!exited) {
52
- // Not finished! Start another task
53
- startTask();
54
- }
55
- } catch (err) {
56
- // Reject only once
57
- if (!exited) {
58
- exited = true;
59
- return reject(err);
60
- }
61
- }
62
- };
63
-
64
- /* ----------- Start Tasks ---------- */
65
-
66
- // If no limit, start all tasks. At least start 1 task
67
- const numTasks = Math.max((limit || taskFunctions.length), 1);
68
- for (let i = 0; i < numTasks; i++) {
69
- startTask();
70
- }
71
- });
72
-
73
- return results;
74
- };
75
-
76
- export default parallelLimit;
@@ -1,29 +0,0 @@
1
- // Constants
2
- const VOWELS = ['a', 'e', 'i', 'o', 'u'];
3
-
4
- /**
5
- * Prefix a word or name with "a" or "an" depending on whether it starts with a
6
- * vowel or not
7
- * @author Gabe Abrams
8
- * @param text the text to prefix
9
- * @param capitalize whether to capitalize the "A" or "An"
10
- * @returns the text prefixed with "a" or "an"
11
- */
12
- const prefixWithAOrAn = (text: string, capitalize = false): string => {
13
- // Get the first letter
14
- const firstLetter = text.charAt(0).toLowerCase();
15
-
16
- // Check if starts with vowel
17
- const startsWithVowel = VOWELS.includes(firstLetter);
18
-
19
- // Determine prefix
20
- let prefix = startsWithVowel ? 'an' : 'a';
21
- if (capitalize) {
22
- prefix = prefix.charAt(0).toUpperCase() + prefix.substring(1);
23
- }
24
-
25
- // Return the text prefixed with "a" or "an"
26
- return `${prefix} ${text}`;
27
- };
28
-
29
- export default prefixWithAOrAn;
@@ -1,13 +0,0 @@
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
- const roundToNumDecimals = (num: number, numDecimals: number): number => {
9
- const rounder = 10 ** numDecimals;
10
- return (Math.round(num * rounder) / rounder);
11
- };
12
-
13
- export default roundToNumDecimals;
@@ -1,19 +0,0 @@
1
- /**
2
- * Shuffle a given array
3
- * @author Austen Money
4
- * @param arr the array to shuffle
5
- * @returns the shuffled array
6
- */
7
- const shuffleArray = <T>(arr: T[]): T[] => {
8
- const newArr = [...arr];
9
-
10
- // Shuffle using Durstenfeld algorithm
11
- for (let i = arr.length - 1; i > 0; i--) {
12
- const j = Math.floor(Math.random() * (i + 1));
13
- [newArr[i], newArr[j]] = [newArr[j], newArr[i]];
14
- }
15
-
16
- return newArr;
17
- };
18
-
19
- export default shuffleArray;
@@ -1,33 +0,0 @@
1
- // Import other helpers
2
- import waitMs from './waitMs';
3
-
4
- /**
5
- * Start a dynamic wait, call the function once the operation has completed and
6
- * the dynamic wait will continue waiting for the rest of the minimum time
7
- * @author Gabe Abrams
8
- * @param minWaitMs the minimum number of ms to wait
9
- * @returns async function to call to finish the wait
10
- */
11
- const startMinWait = (minWaitMs: number): () => Promise<void> => {
12
- const startTimestamp = Date.now();
13
-
14
- /**
15
- * Finish the remaining time to wait
16
- * @author Gabe Abrams
17
- */
18
- return async () => {
19
- const endTimestamp = Date.now();
20
-
21
- // Calculate remaining time to wait
22
- const elapsedTimeMs = (endTimestamp - startTimestamp);
23
- const remainingTimeToWaitMs = minWaitMs - elapsedTimeMs;
24
- if (remainingTimeToWaitMs <= 0) {
25
- return;
26
- }
27
-
28
- // Perform wait
29
- await waitMs(remainingTimeToWaitMs);
30
- };
31
- };
32
-
33
- export default startMinWait;
@@ -1,39 +0,0 @@
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
- const stringsToHumanReadableList = (items: string[]): string => {
10
- // Handle 0-item case
11
- if (items.length === 0) {
12
- return '';
13
- }
14
-
15
- // Handle 1-item case
16
- if (items.length === 1) {
17
- return items[0];
18
- }
19
-
20
- // Handle 2-item case
21
- if (items.length === 2) {
22
- return `${items[0]} and ${items[1]}`;
23
- }
24
-
25
- // Handle 3+ item case
26
- let list = '';
27
- items.forEach((item, i) => {
28
- if (i === items.length - 1) {
29
- // Last item
30
- list += `, and ${item}`;
31
- }
32
-
33
- // Previous items
34
- list += `, ${item}`;
35
- });
36
- return list;
37
- };
38
-
39
- export default stringsToHumanReadableList;
@@ -1,16 +0,0 @@
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
- const sum = (nums: number[]): number => {
8
- return nums.reduce(
9
- (a: number, b: number) => {
10
- return (a + b);
11
- },
12
- 0,
13
- );
14
- };
15
-
16
- export default sum;
@@ -1,85 +0,0 @@
1
- // Importing the testing function
2
- // import chicagoTitleCase from './chicagoTitleCase';
3
-
4
- // // Import constants
5
- // import { INVALID_STRING_ERRORS, INVALID_REGEX_ERROR } from './shared/constants/ERROR_MESSAGES';
6
-
7
- // /*------------------------------------------------------------------------*/
8
- // /* ---------------------------- Valid Tests --------------------------- */
9
- // /*------------------------------------------------------------------------*/
10
-
11
- // const validTests: { input: string, expected: string }[] = [
12
- // {
13
- // input: 'this is the american language',
14
- // expected: 'This the American language',
15
- // },
16
- // {
17
- // input: 'to kill a mockingbird',
18
- // expected: 'To Kill a Mockingbird',
19
- // },
20
- // {
21
- // input: 'the lord of the rings',
22
- // expected: 'The Lord of the Rings',
23
- // },
24
- // {
25
- // input: 'pride and prejudice',
26
- // expected: 'Pride and Prejudice',
27
- // },
28
- // {
29
- // input: 'the road not taken',
30
- // expected: 'The Road Not Taken',
31
- // },
32
- // ];
33
-
34
- // test(
35
- // 'Converts strings to Chicago title case correctly.',
36
- // async () => {
37
- // validTests.forEach(({ input, expected }) => {
38
- // expect(chicagoTitleCase(input)).toBe(expected);
39
- // });
40
- // },
41
- // );
42
-
43
- // /*------------------------------------------------------------------------*/
44
- // /* ---------------------------- Edge Cases ---------------------------- */
45
- // /*------------------------------------------------------------------------*/
46
-
47
- // const edgeCases: { input: string, expected: string }[] = [
48
- // {
49
- // input: 'x',
50
- // expected: 'X',
51
- // },
52
- // {
53
- // input: ' ',
54
- // expected: ' ',
55
- // },
56
- // {
57
- // input: '',
58
- // expected: '',
59
- // },
60
- // {
61
- // input: 'the',
62
- // expected: 'The',
63
- // },
64
- // {
65
- // input: 'THE ROAD NOT TAKEN',
66
- // expected: 'The Road Not Taken',
67
- // },
68
- // {
69
- // input: 'tO kiLL A mOckingBirD',
70
- // expected: 'To Kill a Mockingbird',
71
- // },
72
- // {
73
- // input: 'pRiDe And pReduJiCe',
74
- // expected: 'Pride and Prejudice',
75
- // },
76
- // ];
77
-
78
- // test(
79
- // 'Handles the edge cases for the function that converts a string to Chicago Title Case.',
80
- // async () => {
81
- // edgeCases.forEach(({ input, expected }) => {
82
- // expect(chicagoTitleCase(input)).toBe(expected);
83
- // });
84
- // },
85
- // );
@@ -1,32 +0,0 @@
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
-
10
-
11
- const chicagoTitleCase = (input: string): string => {
12
- // List of lowercase words according to Chicago Manual of Style
13
- const lowerCaseWords: string[] = [
14
- 'in', 'nor', 'of', 'on', 'or', 'as', 'at', 'but', 'by',
15
- 'for', 'if', 'so', 'the', 'a', 'an', 'and', 'to', 'up',
16
- 'yet'
17
- ];
18
-
19
- return input
20
- // Converts given input string to lowercase
21
- .toLowerCase()
22
- // Splits the given string into separate words
23
- .split(' ')
24
- .map((word, index, words) =>
25
- // Capitalize the first word, last word, and the words that aren't
26
- // in lowerCaseWords
27
- index === 0 || !lowerCaseWords.includes(word) || index === words.length - 1
28
- ? `${word.charAt(0).toUpperCase()}${word.slice(1)}` // Capitalize the first letter
29
- : word // Nothing happens to the word
30
- )
31
- .join(' '); // Joins the words back
32
- };