dce-reactkit 4.3.4 → 5.0.0-beta-progress-size-3
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.
- package/dist/cjs/index.js +390 -2390
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/LogReviewer.d.ts +1 -1
- package/dist/cjs/types/helpers/logClientEvent.d.ts +1 -1
- package/dist/cjs/types/html/genErrorPage.d.ts +1 -1
- package/dist/cjs/types/index.d.ts +2 -64
- package/dist/cjs/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/cjs/types/types/ProgressBarSize.d.ts +0 -1
- package/dist/esm/index.js +130 -2297
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/LogReviewer.d.ts +1 -1
- package/dist/esm/types/helpers/logClientEvent.d.ts +1 -1
- package/dist/esm/types/html/genErrorPage.d.ts +1 -1
- package/dist/esm/types/index.d.ts +2 -64
- package/dist/esm/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/esm/types/types/ProgressBarSize.d.ts +0 -1
- package/dist/index.d.ts +3 -836
- package/package.json +4 -3
- package/src/components/AppWrapper.tsx +12 -10
- package/src/components/AutoscrollToBottomContainer.tsx +5 -3
- package/src/components/CopiableBox.tsx +5 -1
- package/src/components/DBEntryManagerPanel/helpers/generateEndpointPath.ts +2 -2
- package/src/components/ErrorBox.tsx +6 -2
- package/src/components/IntelliTable.tsx +7 -5
- package/src/components/LogReviewer.tsx +23 -21
- package/src/components/Modal/index.tsx +5 -3
- package/src/components/MultiSwitch.tsx +5 -1
- package/src/components/ProgressBar.tsx +66 -76
- package/src/components/Shimmer.tsx +4 -2
- package/src/components/SimpleDateChooser.tsx +11 -13
- package/src/components/SimpleTimeChooser.tsx +4 -2
- package/src/helpers/canReviewLogs.test.ts +5 -3
- package/src/helpers/canReviewLogs.ts +5 -3
- package/src/helpers/initClient.tsx +8 -8
- package/src/helpers/isMobileOrTablet.tsx +2 -1
- package/src/helpers/isSelectAdmin.ts +4 -2
- package/src/helpers/logClientEvent.tsx +7 -5
- package/src/helpers/stubServerEndpoint.tsx +1 -1
- package/src/helpers/visitServerEndpoint.tsx +10 -7
- package/src/html/genErrorPage.ts +6 -4
- package/src/index.ts +105 -98
- package/src/types/IntelliTableColumn.ts +4 -1
- package/src/types/ProgressBarSize.ts +0 -1
- package/dist/cjs/types/constants/DAY_IN_MS.d.ts +0 -6
- package/dist/cjs/types/constants/HOUR_IN_MS.d.ts +0 -6
- package/dist/cjs/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +0 -6
- package/dist/cjs/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/cjs/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +0 -7
- package/dist/cjs/types/constants/LOG_ROUTE_PATH.d.ts +0 -6
- package/dist/cjs/types/constants/MINUTE_IN_MS.d.ts +0 -6
- package/dist/cjs/types/constants/ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/cjs/types/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +0 -6
- package/dist/cjs/types/errors/ErrorWithCode.d.ts +0 -9
- package/dist/cjs/types/helpers/abbreviate.d.ts +0 -10
- package/dist/cjs/types/helpers/abbreviate.test.d.ts +0 -5
- package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.d.ts +0 -13
- package/dist/cjs/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.d.ts +0 -13
- package/dist/cjs/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +0 -10
- package/dist/cjs/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.d.ts +0 -11
- package/dist/cjs/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.d.ts +0 -13
- package/dist/cjs/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +0 -1
- package/dist/cjs/types/helpers/avg.d.ts +0 -8
- package/dist/cjs/types/helpers/avg.test.d.ts +0 -5
- package/dist/cjs/types/helpers/capitalize.d.ts +0 -7
- package/dist/cjs/types/helpers/ceilToNumDecimals.d.ts +0 -9
- package/dist/cjs/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
- package/dist/cjs/types/helpers/cloneDeep.d.ts +0 -8
- package/dist/cjs/types/helpers/compareArraysByProp.d.ts +0 -13
- package/dist/cjs/types/helpers/compareArraysByProp.test.d.ts +0 -5
- package/dist/cjs/types/helpers/extractProp.d.ts +0 -12
- package/dist/cjs/types/helpers/extractProp.test.d.ts +0 -5
- package/dist/cjs/types/helpers/floorToNumDecimals.d.ts +0 -9
- package/dist/cjs/types/helpers/floorToNumDecimals.test.d.ts +0 -5
- package/dist/cjs/types/helpers/forceNumIntoBounds.d.ts +0 -10
- package/dist/cjs/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
- package/dist/cjs/types/helpers/genCSV.d.ts +0 -18
- package/dist/cjs/types/helpers/genCSV.test.d.ts +0 -5
- package/dist/cjs/types/helpers/genCommaList.d.ts +0 -12
- package/dist/cjs/types/helpers/genCommaList.test.d.ts +0 -1
- package/dist/cjs/types/helpers/getHumanReadableDate.d.ts +0 -8
- package/dist/cjs/types/helpers/getHumanReadableDate.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getLocalTimeInfo.d.ts +0 -19
- package/dist/cjs/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
- package/dist/cjs/types/helpers/getMonthName.d.ts +0 -14
- package/dist/cjs/types/helpers/getMonthName.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getOrdinal.d.ts +0 -8
- package/dist/cjs/types/helpers/getOrdinal.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getPartOfDay.d.ts +0 -7
- package/dist/cjs/types/helpers/getPartOfDay.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getTimeInfoInET.d.ts +0 -21
- package/dist/cjs/types/helpers/getTimeInfoInET.test.d.ts +0 -5
- package/dist/cjs/types/helpers/getTimestampFromTimeInfoInET.d.ts +0 -20
- package/dist/cjs/types/helpers/getWordCount.d.ts +0 -10
- package/dist/cjs/types/helpers/idify.d.ts +0 -9
- package/dist/cjs/types/helpers/onlyKeepLetters.d.ts +0 -8
- package/dist/cjs/types/helpers/padDecimalZeros.d.ts +0 -10
- package/dist/cjs/types/helpers/padZerosLeft.d.ts +0 -9
- package/dist/cjs/types/helpers/parallelLimit.d.ts +0 -12
- package/dist/cjs/types/helpers/prefixWithAOrAn.d.ts +0 -10
- package/dist/cjs/types/helpers/roundToNumDecimals.d.ts +0 -9
- package/dist/cjs/types/helpers/shuffleArray.d.ts +0 -8
- package/dist/cjs/types/helpers/startMinWait.d.ts +0 -9
- package/dist/cjs/types/helpers/stringsToHumanReadableList.d.ts +0 -10
- package/dist/cjs/types/helpers/sum.d.ts +0 -8
- package/dist/cjs/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
- package/dist/cjs/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
- package/dist/cjs/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
- package/dist/cjs/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
- package/dist/cjs/types/helpers/validators/validURL.d.ts +0 -8
- package/dist/cjs/types/helpers/validators/validateEmail.d.ts +0 -11
- package/dist/cjs/types/helpers/validators/validateEmail.test.d.ts +0 -1
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
- package/dist/cjs/types/helpers/validators/validateString.d.ts +0 -22
- package/dist/cjs/types/helpers/validators/validateString.test.d.ts +0 -1
- package/dist/cjs/types/helpers/waitMs.d.ts +0 -7
- package/dist/cjs/types/types/DayOfWeek.d.ts +0 -14
- package/dist/cjs/types/types/Log/LogMainInfo.d.ts +0 -39
- package/dist/cjs/types/types/Log/LogSourceSpecificInfo.d.ts +0 -13
- package/dist/cjs/types/types/Log/LogTypeSpecificInfo.d.ts +0 -17
- package/dist/cjs/types/types/Log/index.d.ts +0 -10
- package/dist/cjs/types/types/LogAction.d.ts +0 -29
- package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +0 -16
- package/dist/cjs/types/types/LogFunction.d.ts +0 -24
- package/dist/cjs/types/types/LogLevel.d.ts +0 -10
- package/dist/cjs/types/types/LogMetadataContextMap.d.ts +0 -11
- package/dist/cjs/types/types/LogMetadataTagMap.d.ts +0 -8
- package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +0 -8
- package/dist/cjs/types/types/LogMetadataType.d.ts +0 -13
- package/dist/cjs/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +0 -17
- package/dist/cjs/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +0 -21
- package/dist/cjs/types/types/LogReviewerFilterState/ContextFilterState.d.ts +0 -10
- package/dist/cjs/types/types/LogReviewerFilterState/DateFilterState.d.ts +0 -17
- package/dist/cjs/types/types/LogReviewerFilterState/TagFilterState.d.ts +0 -8
- package/dist/cjs/types/types/LogReviewerFilterState/index.d.ts +0 -17
- package/dist/cjs/types/types/LogSource.d.ts +0 -9
- package/dist/cjs/types/types/LogType.d.ts +0 -9
- package/dist/cjs/types/types/ParamType.d.ts +0 -17
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +0 -14
- package/dist/esm/types/constants/DAY_IN_MS.d.ts +0 -6
- package/dist/esm/types/constants/HOUR_IN_MS.d.ts +0 -6
- package/dist/esm/types/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +0 -6
- package/dist/esm/types/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/esm/types/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +0 -7
- package/dist/esm/types/constants/LOG_ROUTE_PATH.d.ts +0 -6
- package/dist/esm/types/constants/MINUTE_IN_MS.d.ts +0 -6
- package/dist/esm/types/constants/ROUTE_PATH_PREFIX.d.ts +0 -6
- package/dist/esm/types/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +0 -6
- package/dist/esm/types/errors/ErrorWithCode.d.ts +0 -9
- package/dist/esm/types/helpers/abbreviate.d.ts +0 -10
- package/dist/esm/types/helpers/abbreviate.test.d.ts +0 -5
- package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.d.ts +0 -13
- package/dist/esm/types/helpers/asyncArrayFunctions/everyAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.d.ts +0 -13
- package/dist/esm/types/helpers/asyncArrayFunctions/filterAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.d.ts +0 -10
- package/dist/esm/types/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.d.ts +0 -11
- package/dist/esm/types/helpers/asyncArrayFunctions/mapAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.d.ts +0 -13
- package/dist/esm/types/helpers/asyncArrayFunctions/someAsync.test.d.ts +0 -1
- package/dist/esm/types/helpers/avg.d.ts +0 -8
- package/dist/esm/types/helpers/avg.test.d.ts +0 -5
- package/dist/esm/types/helpers/capitalize.d.ts +0 -7
- package/dist/esm/types/helpers/ceilToNumDecimals.d.ts +0 -9
- package/dist/esm/types/helpers/ceilToNumDecimals.test.d.ts +0 -5
- package/dist/esm/types/helpers/cloneDeep.d.ts +0 -8
- package/dist/esm/types/helpers/compareArraysByProp.d.ts +0 -13
- package/dist/esm/types/helpers/compareArraysByProp.test.d.ts +0 -5
- package/dist/esm/types/helpers/extractProp.d.ts +0 -12
- package/dist/esm/types/helpers/extractProp.test.d.ts +0 -5
- package/dist/esm/types/helpers/floorToNumDecimals.d.ts +0 -9
- package/dist/esm/types/helpers/floorToNumDecimals.test.d.ts +0 -5
- package/dist/esm/types/helpers/forceNumIntoBounds.d.ts +0 -10
- package/dist/esm/types/helpers/forceNumIntoBounds.test.d.ts +0 -5
- package/dist/esm/types/helpers/genCSV.d.ts +0 -18
- package/dist/esm/types/helpers/genCSV.test.d.ts +0 -5
- package/dist/esm/types/helpers/genCommaList.d.ts +0 -12
- package/dist/esm/types/helpers/genCommaList.test.d.ts +0 -1
- package/dist/esm/types/helpers/getHumanReadableDate.d.ts +0 -8
- package/dist/esm/types/helpers/getHumanReadableDate.test.d.ts +0 -5
- package/dist/esm/types/helpers/getLocalTimeInfo.d.ts +0 -19
- package/dist/esm/types/helpers/getLocalTimeInfo.test.d.ts +0 -6
- package/dist/esm/types/helpers/getMonthName.d.ts +0 -14
- package/dist/esm/types/helpers/getMonthName.test.d.ts +0 -5
- package/dist/esm/types/helpers/getOrdinal.d.ts +0 -8
- package/dist/esm/types/helpers/getOrdinal.test.d.ts +0 -5
- package/dist/esm/types/helpers/getPartOfDay.d.ts +0 -7
- package/dist/esm/types/helpers/getPartOfDay.test.d.ts +0 -5
- package/dist/esm/types/helpers/getTimeInfoInET.d.ts +0 -21
- package/dist/esm/types/helpers/getTimeInfoInET.test.d.ts +0 -5
- package/dist/esm/types/helpers/getTimestampFromTimeInfoInET.d.ts +0 -20
- package/dist/esm/types/helpers/getWordCount.d.ts +0 -10
- package/dist/esm/types/helpers/idify.d.ts +0 -9
- package/dist/esm/types/helpers/onlyKeepLetters.d.ts +0 -8
- package/dist/esm/types/helpers/padDecimalZeros.d.ts +0 -10
- package/dist/esm/types/helpers/padZerosLeft.d.ts +0 -9
- package/dist/esm/types/helpers/parallelLimit.d.ts +0 -12
- package/dist/esm/types/helpers/prefixWithAOrAn.d.ts +0 -10
- package/dist/esm/types/helpers/roundToNumDecimals.d.ts +0 -9
- package/dist/esm/types/helpers/shuffleArray.d.ts +0 -8
- package/dist/esm/types/helpers/startMinWait.d.ts +0 -9
- package/dist/esm/types/helpers/stringsToHumanReadableList.d.ts +0 -10
- package/dist/esm/types/helpers/sum.d.ts +0 -8
- package/dist/esm/types/helpers/validators/ChicagoTitleCase.d.ts +0 -9
- package/dist/esm/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +0 -10
- package/dist/esm/types/helpers/validators/shared/helpers/validateRegex.d.ts +0 -19
- package/dist/esm/types/helpers/validators/shared/types/ValidationResult.d.ts +0 -12
- package/dist/esm/types/helpers/validators/validURL.d.ts +0 -8
- package/dist/esm/types/helpers/validators/validateEmail.d.ts +0 -11
- package/dist/esm/types/helpers/validators/validateEmail.test.d.ts +0 -1
- package/dist/esm/types/helpers/validators/validatePhoneNumber.d.ts +0 -11
- package/dist/esm/types/helpers/validators/validatePhoneNumber.test.d.ts +0 -1
- package/dist/esm/types/helpers/validators/validateString.d.ts +0 -22
- package/dist/esm/types/helpers/validators/validateString.test.d.ts +0 -1
- package/dist/esm/types/helpers/waitMs.d.ts +0 -7
- package/dist/esm/types/types/DayOfWeek.d.ts +0 -14
- package/dist/esm/types/types/Log/LogMainInfo.d.ts +0 -39
- package/dist/esm/types/types/Log/LogSourceSpecificInfo.d.ts +0 -13
- package/dist/esm/types/types/Log/LogTypeSpecificInfo.d.ts +0 -17
- package/dist/esm/types/types/Log/index.d.ts +0 -10
- package/dist/esm/types/types/LogAction.d.ts +0 -29
- package/dist/esm/types/types/LogBuiltInMetadata.d.ts +0 -16
- package/dist/esm/types/types/LogFunction.d.ts +0 -24
- package/dist/esm/types/types/LogLevel.d.ts +0 -10
- package/dist/esm/types/types/LogMetadataContextMap.d.ts +0 -11
- package/dist/esm/types/types/LogMetadataTagMap.d.ts +0 -8
- package/dist/esm/types/types/LogMetadataTargetMap.d.ts +0 -8
- package/dist/esm/types/types/LogMetadataType.d.ts +0 -13
- package/dist/esm/types/types/LogReviewerFilterState/ActionErrorFilterState.d.ts +0 -17
- package/dist/esm/types/types/LogReviewerFilterState/AdvancedFilterState.d.ts +0 -21
- package/dist/esm/types/types/LogReviewerFilterState/ContextFilterState.d.ts +0 -10
- package/dist/esm/types/types/LogReviewerFilterState/DateFilterState.d.ts +0 -17
- package/dist/esm/types/types/LogReviewerFilterState/TagFilterState.d.ts +0 -8
- package/dist/esm/types/types/LogReviewerFilterState/index.d.ts +0 -17
- package/dist/esm/types/types/LogSource.d.ts +0 -9
- package/dist/esm/types/types/LogType.d.ts +0 -9
- package/dist/esm/types/types/ParamType.d.ts +0 -17
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +0 -14
- package/src/constants/DAY_IN_MS.ts +0 -7
- package/src/constants/HOUR_IN_MS.ts +0 -7
- package/src/constants/LOG_REVIEW_GET_LOGS_ROUTE.ts +0 -9
- package/src/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.ts +0 -9
- package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +0 -10
- package/src/constants/LOG_ROUTE_PATH.ts +0 -9
- package/src/constants/MINUTE_IN_MS.ts +0 -7
- package/src/constants/ROUTE_PATH_PREFIX.ts +0 -7
- package/src/constants/SELECT_ADMIN_CHECK_ROUTE.ts +0 -7
- package/src/errors/ErrorWithCode.tsx +0 -15
- package/src/helpers/abbreviate.test.ts +0 -26
- package/src/helpers/abbreviate.ts +0 -25
- package/src/helpers/asyncArrayFunctions/everyAsync.test.ts +0 -114
- package/src/helpers/asyncArrayFunctions/everyAsync.ts +0 -51
- package/src/helpers/asyncArrayFunctions/filterAsync.test.ts +0 -126
- package/src/helpers/asyncArrayFunctions/filterAsync.ts +0 -50
- package/src/helpers/asyncArrayFunctions/forEachAsync.test.ts +0 -136
- package/src/helpers/asyncArrayFunctions/forEachAsync.ts +0 -40
- package/src/helpers/asyncArrayFunctions/mapAsync.test.ts +0 -125
- package/src/helpers/asyncArrayFunctions/mapAsync.ts +0 -46
- package/src/helpers/asyncArrayFunctions/someAsync.test.ts +0 -92
- package/src/helpers/asyncArrayFunctions/someAsync.ts +0 -49
- package/src/helpers/avg.test.ts +0 -24
- package/src/helpers/avg.ts +0 -22
- package/src/helpers/capitalize.ts +0 -20
- package/src/helpers/ceilToNumDecimals.test.ts +0 -39
- package/src/helpers/ceilToNumDecimals.ts +0 -13
- package/src/helpers/cloneDeep.ts +0 -11
- package/src/helpers/compareArraysByProp.test.ts +0 -147
- package/src/helpers/compareArraysByProp.ts +0 -56
- package/src/helpers/extractProp.test.ts +0 -34
- package/src/helpers/extractProp.ts +0 -17
- package/src/helpers/floorToNumDecimals.test.ts +0 -39
- package/src/helpers/floorToNumDecimals.ts +0 -13
- package/src/helpers/forceNumIntoBounds.test.ts +0 -34
- package/src/helpers/forceNumIntoBounds.ts +0 -19
- package/src/helpers/genCSV.test.ts +0 -75
- package/src/helpers/genCSV.ts +0 -87
- package/src/helpers/genCommaList.test.ts +0 -57
- package/src/helpers/genCommaList.ts +0 -21
- package/src/helpers/getHumanReadableDate.test.ts +0 -29
- package/src/helpers/getHumanReadableDate.ts +0 -36
- package/src/helpers/getLocalTimeInfo.test.ts +0 -48
- package/src/helpers/getLocalTimeInfo.ts +0 -58
- package/src/helpers/getMonthName.test.ts +0 -79
- package/src/helpers/getMonthName.ts +0 -29
- package/src/helpers/getOrdinal.test.ts +0 -84
- package/src/helpers/getOrdinal.ts +0 -14
- package/src/helpers/getPartOfDay.test.ts +0 -56
- package/src/helpers/getPartOfDay.ts +0 -20
- package/src/helpers/getTimeInfoInET.test.ts +0 -72
- package/src/helpers/getTimeInfoInET.ts +0 -79
- package/src/helpers/getTimestampFromTimeInfoInET.ts +0 -179
- package/src/helpers/getWordCount.ts +0 -26
- package/src/helpers/idify.ts +0 -24
- package/src/helpers/onlyKeepLetters.ts +0 -11
- package/src/helpers/padDecimalZeros.tsx +0 -32
- package/src/helpers/padZerosLeft.tsx +0 -21
- package/src/helpers/parallelLimit.ts +0 -63
- package/src/helpers/prefixWithAOrAn.ts +0 -29
- package/src/helpers/roundToNumDecimals.tsx +0 -13
- package/src/helpers/shuffleArray.ts +0 -19
- package/src/helpers/startMinWait.ts +0 -33
- package/src/helpers/stringsToHumanReadableList.ts +0 -39
- package/src/helpers/sum.tsx +0 -16
- package/src/helpers/validators/ChicagoTitleCase.test.ts +0 -85
- package/src/helpers/validators/ChicagoTitleCase.ts +0 -32
- package/src/helpers/validators/findURL.test.ts +0 -83
- package/src/helpers/validators/findURL.ts +0 -43
- package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +0 -18
- package/src/helpers/validators/shared/helpers/validateRegex.ts +0 -47
- package/src/helpers/validators/shared/types/ValidationResult.ts +0 -20
- package/src/helpers/validators/validURL.test.ts +0 -90
- package/src/helpers/validators/validURL.ts +0 -18
- package/src/helpers/validators/validateEmail.test.ts +0 -110
- package/src/helpers/validators/validateEmail.ts +0 -47
- package/src/helpers/validators/validatePhoneNumber.test.ts +0 -94
- package/src/helpers/validators/validatePhoneNumber.ts +0 -49
- package/src/helpers/validators/validateString.test.ts +0 -173
- package/src/helpers/validators/validateString.ts +0 -171
- package/src/helpers/waitMs.tsx +0 -12
- package/src/types/DayOfWeek.ts +0 -15
- package/src/types/Log/LogMainInfo.ts +0 -69
- package/src/types/Log/LogSourceSpecificInfo.ts +0 -25
- package/src/types/Log/LogTypeSpecificInfo.ts +0 -33
- package/src/types/Log/index.ts +0 -17
- package/src/types/LogAction.ts +0 -52
- package/src/types/LogBuiltInMetadata.ts +0 -19
- package/src/types/LogFunction.ts +0 -46
- package/src/types/LogLevel.ts +0 -11
- package/src/types/LogMetadataContextMap.ts +0 -15
- package/src/types/LogMetadataTagMap.ts +0 -9
- package/src/types/LogMetadataTargetMap.ts +0 -9
- package/src/types/LogMetadataType.ts +0 -16
- package/src/types/LogReviewerFilterState/ActionErrorFilterState.ts +0 -24
- package/src/types/LogReviewerFilterState/AdvancedFilterState.ts +0 -36
- package/src/types/LogReviewerFilterState/ContextFilterState.ts +0 -16
- package/src/types/LogReviewerFilterState/DateFilterState.ts +0 -26
- package/src/types/LogReviewerFilterState/TagFilterState.ts +0 -9
- package/src/types/LogReviewerFilterState/index.ts +0 -24
- package/src/types/LogSource.ts +0 -12
- package/src/types/LogType.ts +0 -12
- package/src/types/ParamType.ts +0 -18
- 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;
|
package/src/helpers/idify.ts
DELETED
|
@@ -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,63 +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
|
-
// Wait until finished with all tasks
|
|
18
|
-
await new Promise<void>((resolve) => {
|
|
19
|
-
/* ------------- Helpers ------------ */
|
|
20
|
-
|
|
21
|
-
let nextTaskIndex = 0;
|
|
22
|
-
let numFinishedTasks = 0;
|
|
23
|
-
/**
|
|
24
|
-
* Start the next task
|
|
25
|
-
* @author Gabe Abrams
|
|
26
|
-
*/
|
|
27
|
-
const startTask = async () => {
|
|
28
|
-
const taskIndex = nextTaskIndex++;
|
|
29
|
-
|
|
30
|
-
// Get the task
|
|
31
|
-
const taskFunction = taskFunctions[taskIndex];
|
|
32
|
-
if (!taskFunction) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Execute task
|
|
37
|
-
const result = await taskFunction();
|
|
38
|
-
|
|
39
|
-
// Add results
|
|
40
|
-
results[taskIndex] = result;
|
|
41
|
-
|
|
42
|
-
// Tally and finish
|
|
43
|
-
if (++numFinishedTasks === taskFunctions.length) {
|
|
44
|
-
return resolve();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Not finished! Start another task
|
|
48
|
-
startTask();
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/* ----------- Start Tasks ---------- */
|
|
52
|
-
|
|
53
|
-
// If no limit, start all tasks. At least start 1 task
|
|
54
|
-
const numTasks = Math.max((limit || taskFunctions.length), 1);
|
|
55
|
-
for (let i = 0; i < numTasks; i++) {
|
|
56
|
-
startTask();
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return results;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
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;
|
package/src/helpers/sum.tsx
DELETED
|
@@ -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
|
-
};
|