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.
- package/.eslintrc.js +93 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/lib/constants/DAY_IN_MS.d.ts +6 -0
- package/lib/constants/DAY_IN_MS.js +9 -0
- package/lib/constants/DAY_IN_MS.js.map +1 -0
- package/lib/constants/HOUR_IN_MS.d.ts +6 -0
- package/lib/constants/HOUR_IN_MS.js +9 -0
- package/lib/constants/HOUR_IN_MS.js.map +1 -0
- package/lib/constants/LOG_REVIEW_GET_LOGS_ROUTE.d.ts +6 -0
- package/lib/constants/LOG_REVIEW_GET_LOGS_ROUTE.js +13 -0
- package/lib/constants/LOG_REVIEW_GET_LOGS_ROUTE.js.map +1 -0
- package/lib/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.d.ts +6 -0
- package/lib/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.js +13 -0
- package/lib/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.js.map +1 -0
- package/lib/constants/LOG_REVIEW_STATUS_ROUTE.d.ts +7 -0
- package/lib/constants/LOG_REVIEW_STATUS_ROUTE.js +14 -0
- package/lib/constants/LOG_REVIEW_STATUS_ROUTE.js.map +1 -0
- package/lib/constants/LOG_ROUTE_PATH.d.ts +6 -0
- package/lib/constants/LOG_ROUTE_PATH.js +13 -0
- package/lib/constants/LOG_ROUTE_PATH.js.map +1 -0
- package/lib/constants/MINUTE_IN_MS.d.ts +6 -0
- package/lib/constants/MINUTE_IN_MS.js +9 -0
- package/lib/constants/MINUTE_IN_MS.js.map +1 -0
- package/lib/constants/ROUTE_PATH_PREFIX.d.ts +6 -0
- package/lib/constants/ROUTE_PATH_PREFIX.js +9 -0
- package/lib/constants/ROUTE_PATH_PREFIX.js.map +1 -0
- package/lib/constants/SELECT_ADMIN_CHECK_ROUTE.d.ts +6 -0
- package/lib/constants/SELECT_ADMIN_CHECK_ROUTE.js +9 -0
- package/lib/constants/SELECT_ADMIN_CHECK_ROUTE.js.map +1 -0
- package/lib/errors/ErrorWithCode.d.ts +9 -0
- package/lib/errors/ErrorWithCode.js +33 -0
- package/lib/errors/ErrorWithCode.js.map +1 -0
- package/lib/helpers/abbreviate.d.ts +10 -0
- package/lib/helpers/abbreviate.js +24 -0
- package/lib/helpers/abbreviate.js.map +1 -0
- package/lib/helpers/abbreviate.test.d.ts +5 -0
- package/lib/helpers/abbreviate.test.js +28 -0
- package/lib/helpers/abbreviate.test.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/everyAsync.d.ts +13 -0
- package/lib/helpers/asyncArrayFunctions/everyAsync.js +81 -0
- package/lib/helpers/asyncArrayFunctions/everyAsync.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/everyAsync.test.d.ts +1 -0
- package/lib/helpers/asyncArrayFunctions/everyAsync.test.js +219 -0
- package/lib/helpers/asyncArrayFunctions/everyAsync.test.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/filterAsync.d.ts +13 -0
- package/lib/helpers/asyncArrayFunctions/filterAsync.js +81 -0
- package/lib/helpers/asyncArrayFunctions/filterAsync.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/filterAsync.test.d.ts +1 -0
- package/lib/helpers/asyncArrayFunctions/filterAsync.test.js +244 -0
- package/lib/helpers/asyncArrayFunctions/filterAsync.test.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/forEachAsync.d.ts +10 -0
- package/lib/helpers/asyncArrayFunctions/forEachAsync.js +72 -0
- package/lib/helpers/asyncArrayFunctions/forEachAsync.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/forEachAsync.test.d.ts +1 -0
- package/lib/helpers/asyncArrayFunctions/forEachAsync.test.js +223 -0
- package/lib/helpers/asyncArrayFunctions/forEachAsync.test.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/mapAsync.d.ts +11 -0
- package/lib/helpers/asyncArrayFunctions/mapAsync.js +77 -0
- package/lib/helpers/asyncArrayFunctions/mapAsync.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/mapAsync.test.d.ts +1 -0
- package/lib/helpers/asyncArrayFunctions/mapAsync.test.js +219 -0
- package/lib/helpers/asyncArrayFunctions/mapAsync.test.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/someAsync.d.ts +13 -0
- package/lib/helpers/asyncArrayFunctions/someAsync.js +80 -0
- package/lib/helpers/asyncArrayFunctions/someAsync.js.map +1 -0
- package/lib/helpers/asyncArrayFunctions/someAsync.test.d.ts +1 -0
- package/lib/helpers/asyncArrayFunctions/someAsync.test.js +227 -0
- package/lib/helpers/asyncArrayFunctions/someAsync.test.js.map +1 -0
- package/lib/helpers/avg.d.ts +8 -0
- package/lib/helpers/avg.js +24 -0
- package/lib/helpers/avg.js.map +1 -0
- package/lib/helpers/avg.test.d.ts +5 -0
- package/lib/helpers/avg.test.js +25 -0
- package/lib/helpers/avg.test.js.map +1 -0
- package/lib/helpers/capitalize.d.ts +7 -0
- package/lib/helpers/capitalize.js +20 -0
- package/lib/helpers/capitalize.js.map +1 -0
- package/lib/helpers/ceilToNumDecimals.d.ts +9 -0
- package/lib/helpers/ceilToNumDecimals.js +15 -0
- package/lib/helpers/ceilToNumDecimals.js.map +1 -0
- package/lib/helpers/ceilToNumDecimals.test.d.ts +5 -0
- package/lib/helpers/ceilToNumDecimals.test.js +38 -0
- package/lib/helpers/ceilToNumDecimals.test.js.map +1 -0
- package/lib/helpers/cloneDeep.d.ts +8 -0
- package/lib/helpers/cloneDeep.js +15 -0
- package/lib/helpers/cloneDeep.js.map +1 -0
- package/lib/helpers/compareArraysByProp.d.ts +13 -0
- package/lib/helpers/compareArraysByProp.js +62 -0
- package/lib/helpers/compareArraysByProp.js.map +1 -0
- package/lib/helpers/compareArraysByProp.test.d.ts +5 -0
- package/lib/helpers/compareArraysByProp.test.js +140 -0
- package/lib/helpers/compareArraysByProp.test.js.map +1 -0
- package/lib/helpers/extractProp.d.ts +12 -0
- package/lib/helpers/extractProp.js +19 -0
- package/lib/helpers/extractProp.js.map +1 -0
- package/lib/helpers/extractProp.test.d.ts +5 -0
- package/lib/helpers/extractProp.test.js +36 -0
- package/lib/helpers/extractProp.test.js.map +1 -0
- package/lib/helpers/floorToNumDecimals.d.ts +9 -0
- package/lib/helpers/floorToNumDecimals.js +15 -0
- package/lib/helpers/floorToNumDecimals.js.map +1 -0
- package/lib/helpers/floorToNumDecimals.test.d.ts +5 -0
- package/lib/helpers/floorToNumDecimals.test.js +38 -0
- package/lib/helpers/floorToNumDecimals.test.js.map +1 -0
- package/lib/helpers/forceNumIntoBounds.d.ts +10 -0
- package/lib/helpers/forceNumIntoBounds.js +15 -0
- package/lib/helpers/forceNumIntoBounds.js.map +1 -0
- package/lib/helpers/forceNumIntoBounds.test.d.ts +5 -0
- package/lib/helpers/forceNumIntoBounds.test.js +34 -0
- package/lib/helpers/forceNumIntoBounds.test.js.map +1 -0
- package/lib/helpers/genCSV.d.ts +18 -0
- package/lib/helpers/genCSV.js +69 -0
- package/lib/helpers/genCSV.js.map +1 -0
- package/lib/helpers/genCSV.test.d.ts +5 -0
- package/lib/helpers/genCSV.test.js +75 -0
- package/lib/helpers/genCSV.test.js.map +1 -0
- package/lib/helpers/genCommaList.d.ts +12 -0
- package/lib/helpers/genCommaList.js +20 -0
- package/lib/helpers/genCommaList.js.map +1 -0
- package/lib/helpers/genCommaList.test.d.ts +1 -0
- package/lib/helpers/genCommaList.test.js +94 -0
- package/lib/helpers/genCommaList.test.js.map +1 -0
- package/lib/helpers/getHumanReadableDate.d.ts +8 -0
- package/lib/helpers/getHumanReadableDate.js +32 -0
- package/lib/helpers/getHumanReadableDate.js.map +1 -0
- package/lib/helpers/getHumanReadableDate.test.d.ts +5 -0
- package/lib/helpers/getHumanReadableDate.test.js +31 -0
- package/lib/helpers/getHumanReadableDate.test.js.map +1 -0
- package/lib/helpers/getLocalTimeInfo.d.ts +19 -0
- package/lib/helpers/getLocalTimeInfo.js +51 -0
- package/lib/helpers/getLocalTimeInfo.js.map +1 -0
- package/lib/helpers/getLocalTimeInfo.test.d.ts +6 -0
- package/lib/helpers/getLocalTimeInfo.test.js +50 -0
- package/lib/helpers/getLocalTimeInfo.test.js.map +1 -0
- package/lib/helpers/getMonthName.d.ts +14 -0
- package/lib/helpers/getMonthName.js +31 -0
- package/lib/helpers/getMonthName.js.map +1 -0
- package/lib/helpers/getMonthName.test.d.ts +5 -0
- package/lib/helpers/getMonthName.test.js +70 -0
- package/lib/helpers/getMonthName.test.js.map +1 -0
- package/lib/helpers/getOrdinal.d.ts +8 -0
- package/lib/helpers/getOrdinal.js +16 -0
- package/lib/helpers/getOrdinal.js.map +1 -0
- package/lib/helpers/getOrdinal.test.d.ts +5 -0
- package/lib/helpers/getOrdinal.test.js +74 -0
- package/lib/helpers/getOrdinal.test.js.map +1 -0
- package/lib/helpers/getPartOfDay.d.ts +7 -0
- package/lib/helpers/getPartOfDay.js +24 -0
- package/lib/helpers/getPartOfDay.js.map +1 -0
- package/lib/helpers/getPartOfDay.test.d.ts +5 -0
- package/lib/helpers/getPartOfDay.test.js +49 -0
- package/lib/helpers/getPartOfDay.test.js.map +1 -0
- package/lib/helpers/getTimeInfoInET.d.ts +21 -0
- package/lib/helpers/getTimeInfoInET.js +67 -0
- package/lib/helpers/getTimeInfoInET.js.map +1 -0
- package/lib/helpers/getTimeInfoInET.test.d.ts +5 -0
- package/lib/helpers/getTimeInfoInET.test.js +74 -0
- package/lib/helpers/getTimeInfoInET.test.js.map +1 -0
- package/lib/helpers/getTimestampFromTimeInfoInET.d.ts +20 -0
- package/lib/helpers/getTimestampFromTimeInfoInET.js +136 -0
- package/lib/helpers/getTimestampFromTimeInfoInET.js.map +1 -0
- package/lib/helpers/getWordCount.d.ts +10 -0
- package/lib/helpers/getWordCount.js +24 -0
- package/lib/helpers/getWordCount.js.map +1 -0
- package/lib/helpers/idify.d.ts +9 -0
- package/lib/helpers/idify.js +24 -0
- package/lib/helpers/idify.js.map +1 -0
- package/lib/helpers/onlyKeepLetters.d.ts +8 -0
- package/lib/helpers/onlyKeepLetters.js +13 -0
- package/lib/helpers/onlyKeepLetters.js.map +1 -0
- package/lib/helpers/padDecimalZeros.d.ts +10 -0
- package/lib/helpers/padDecimalZeros.js +30 -0
- package/lib/helpers/padDecimalZeros.js.map +1 -0
- package/lib/helpers/padZerosLeft.d.ts +9 -0
- package/lib/helpers/padZerosLeft.js +21 -0
- package/lib/helpers/padZerosLeft.js.map +1 -0
- package/lib/helpers/parallelLimit.d.ts +12 -0
- package/lib/helpers/parallelLimit.js +104 -0
- package/lib/helpers/parallelLimit.js.map +1 -0
- package/lib/helpers/prefixWithAOrAn.d.ts +10 -0
- package/lib/helpers/prefixWithAOrAn.js +28 -0
- package/lib/helpers/prefixWithAOrAn.js.map +1 -0
- package/lib/helpers/roundToNumDecimals.d.ts +9 -0
- package/lib/helpers/roundToNumDecimals.js +15 -0
- package/lib/helpers/roundToNumDecimals.js.map +1 -0
- package/lib/helpers/shuffleArray.d.ts +8 -0
- package/lib/helpers/shuffleArray.js +29 -0
- package/lib/helpers/shuffleArray.js.map +1 -0
- package/lib/helpers/startMinWait.d.ts +9 -0
- package/lib/helpers/startMinWait.js +79 -0
- package/lib/helpers/startMinWait.js.map +1 -0
- package/lib/helpers/stringsToHumanReadableList.d.ts +10 -0
- package/lib/helpers/stringsToHumanReadableList.js +37 -0
- package/lib/helpers/stringsToHumanReadableList.js.map +1 -0
- package/lib/helpers/sum.d.ts +8 -0
- package/lib/helpers/sum.js +15 -0
- package/lib/helpers/sum.js.map +1 -0
- package/lib/helpers/validators/ChicagoTitleCase.d.ts +9 -0
- package/lib/helpers/validators/ChicagoTitleCase.js +31 -0
- package/lib/helpers/validators/ChicagoTitleCase.js.map +1 -0
- package/lib/helpers/validators/ChicagoTitleCase.test.d.ts +0 -0
- package/lib/helpers/validators/ChicagoTitleCase.test.js +79 -0
- package/lib/helpers/validators/ChicagoTitleCase.test.js.map +1 -0
- package/lib/helpers/validators/findURL.d.ts +0 -0
- package/lib/helpers/validators/findURL.js +39 -0
- package/lib/helpers/validators/findURL.js.map +1 -0
- package/lib/helpers/validators/findURL.test.d.ts +0 -0
- package/lib/helpers/validators/findURL.test.js +77 -0
- package/lib/helpers/validators/findURL.test.js.map +1 -0
- package/lib/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +10 -0
- package/lib/helpers/validators/shared/constants/ERROR_MESSAGES.js +21 -0
- package/lib/helpers/validators/shared/constants/ERROR_MESSAGES.js.map +1 -0
- package/lib/helpers/validators/shared/helpers/validateRegex.d.ts +19 -0
- package/lib/helpers/validators/shared/helpers/validateRegex.js +34 -0
- package/lib/helpers/validators/shared/helpers/validateRegex.js.map +1 -0
- package/lib/helpers/validators/shared/types/ValidationResult.d.ts +12 -0
- package/lib/helpers/validators/shared/types/ValidationResult.js +3 -0
- package/lib/helpers/validators/shared/types/ValidationResult.js.map +1 -0
- package/lib/helpers/validators/validURL.d.ts +8 -0
- package/lib/helpers/validators/validURL.js +20 -0
- package/lib/helpers/validators/validURL.js.map +1 -0
- package/lib/helpers/validators/validURL.test.d.ts +0 -0
- package/lib/helpers/validators/validURL.test.js +83 -0
- package/lib/helpers/validators/validURL.test.js.map +1 -0
- package/lib/helpers/validators/validateEmail.d.ts +11 -0
- package/lib/helpers/validators/validateEmail.js +39 -0
- package/lib/helpers/validators/validateEmail.js.map +1 -0
- package/lib/helpers/validators/validateEmail.test.d.ts +1 -0
- package/lib/helpers/validators/validateEmail.test.js +140 -0
- package/lib/helpers/validators/validateEmail.test.js.map +1 -0
- package/lib/helpers/validators/validatePhoneNumber.d.ts +11 -0
- package/lib/helpers/validators/validatePhoneNumber.js +40 -0
- package/lib/helpers/validators/validatePhoneNumber.js.map +1 -0
- package/lib/helpers/validators/validatePhoneNumber.test.d.ts +1 -0
- package/lib/helpers/validators/validatePhoneNumber.test.js +123 -0
- package/lib/helpers/validators/validatePhoneNumber.test.js.map +1 -0
- package/lib/helpers/validators/validateString.d.ts +22 -0
- package/lib/helpers/validators/validateString.js +124 -0
- package/lib/helpers/validators/validateString.js.map +1 -0
- package/lib/helpers/validators/validateString.test.d.ts +1 -0
- package/lib/helpers/validators/validateString.test.js +163 -0
- package/lib/helpers/validators/validateString.test.js.map +1 -0
- package/lib/helpers/waitMs.d.ts +7 -0
- package/lib/helpers/waitMs.js +68 -0
- package/lib/helpers/waitMs.js.map +1 -0
- package/lib/index.d.ts +63 -0
- package/lib/index.js +124 -0
- package/lib/index.js.map +1 -0
- package/lib/types/CommonKitErrorCode.d.ts +10 -0
- package/lib/types/CommonKitErrorCode.js +15 -0
- package/lib/types/CommonKitErrorCode.js.map +1 -0
- package/lib/types/DayOfWeek.d.ts +14 -0
- package/lib/types/DayOfWeek.js +18 -0
- package/lib/types/DayOfWeek.js.map +1 -0
- package/lib/types/Log/LogMainInfo.d.ts +39 -0
- package/lib/types/Log/LogMainInfo.js +3 -0
- package/lib/types/Log/LogMainInfo.js.map +1 -0
- package/lib/types/Log/LogSourceSpecificInfo.d.ts +13 -0
- package/lib/types/Log/LogSourceSpecificInfo.js +3 -0
- package/lib/types/Log/LogSourceSpecificInfo.js.map +1 -0
- package/lib/types/Log/LogTypeSpecificInfo.d.ts +17 -0
- package/lib/types/Log/LogTypeSpecificInfo.js +3 -0
- package/lib/types/Log/LogTypeSpecificInfo.js.map +1 -0
- package/lib/types/Log/index.d.ts +10 -0
- package/lib/types/Log/index.js +3 -0
- package/lib/types/Log/index.js.map +1 -0
- package/lib/types/LogAction.d.ts +29 -0
- package/lib/types/LogAction.js +55 -0
- package/lib/types/LogAction.js.map +1 -0
- package/lib/types/LogBuiltInMetadata.d.ts +16 -0
- package/lib/types/LogBuiltInMetadata.js +21 -0
- package/lib/types/LogBuiltInMetadata.js.map +1 -0
- package/lib/types/LogFunction.d.ts +24 -0
- package/lib/types/LogFunction.js +3 -0
- package/lib/types/LogFunction.js.map +1 -0
- package/lib/types/LogLevel.d.ts +10 -0
- package/lib/types/LogLevel.js +14 -0
- package/lib/types/LogLevel.js.map +1 -0
- package/lib/types/LogMetadataContextMap.d.ts +11 -0
- package/lib/types/LogMetadataContextMap.js +3 -0
- package/lib/types/LogMetadataContextMap.js.map +1 -0
- package/lib/types/LogMetadataTagMap.d.ts +8 -0
- package/lib/types/LogMetadataTagMap.js +3 -0
- package/lib/types/LogMetadataTagMap.js.map +1 -0
- package/lib/types/LogMetadataTargetMap.d.ts +8 -0
- package/lib/types/LogMetadataTargetMap.js +3 -0
- package/lib/types/LogMetadataTargetMap.js.map +1 -0
- package/lib/types/LogMetadataType.d.ts +13 -0
- package/lib/types/LogMetadataType.js +3 -0
- package/lib/types/LogMetadataType.js.map +1 -0
- package/lib/types/LogSource.d.ts +9 -0
- package/lib/types/LogSource.js +15 -0
- package/lib/types/LogSource.js.map +1 -0
- package/lib/types/LogType.d.ts +9 -0
- package/lib/types/LogType.js +15 -0
- package/lib/types/LogType.js.map +1 -0
- package/lib/types/ParamType.d.ts +17 -0
- package/lib/types/ParamType.js +21 -0
- package/lib/types/ParamType.js.map +1 -0
- package/package.json +47 -0
- package/src/constants/DAY_IN_MS.ts +7 -0
- package/src/constants/HOUR_IN_MS.ts +7 -0
- package/src/constants/LOG_REVIEW_GET_LOGS_ROUTE.ts +9 -0
- package/src/constants/LOG_REVIEW_ROUTE_PATH_PREFIX.ts +9 -0
- package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +10 -0
- package/src/constants/LOG_ROUTE_PATH.ts +9 -0
- package/src/constants/MINUTE_IN_MS.ts +7 -0
- package/src/constants/ROUTE_PATH_PREFIX.ts +7 -0
- package/src/constants/SELECT_ADMIN_CHECK_ROUTE.ts +7 -0
- package/src/errors/ErrorWithCode.ts +15 -0
- package/src/helpers/abbreviate.test.ts +26 -0
- package/src/helpers/abbreviate.ts +25 -0
- package/src/helpers/asyncArrayFunctions/everyAsync.test.ts +114 -0
- package/src/helpers/asyncArrayFunctions/everyAsync.ts +51 -0
- package/src/helpers/asyncArrayFunctions/filterAsync.test.ts +126 -0
- package/src/helpers/asyncArrayFunctions/filterAsync.ts +50 -0
- package/src/helpers/asyncArrayFunctions/forEachAsync.test.ts +136 -0
- package/src/helpers/asyncArrayFunctions/forEachAsync.ts +40 -0
- package/src/helpers/asyncArrayFunctions/mapAsync.test.ts +125 -0
- package/src/helpers/asyncArrayFunctions/mapAsync.ts +46 -0
- package/src/helpers/asyncArrayFunctions/someAsync.test.ts +92 -0
- package/src/helpers/asyncArrayFunctions/someAsync.ts +49 -0
- package/src/helpers/avg.test.ts +24 -0
- package/src/helpers/avg.ts +22 -0
- package/src/helpers/capitalize.ts +20 -0
- package/src/helpers/ceilToNumDecimals.test.ts +39 -0
- package/src/helpers/ceilToNumDecimals.ts +13 -0
- package/src/helpers/cloneDeep.ts +11 -0
- package/src/helpers/compareArraysByProp.test.ts +147 -0
- package/src/helpers/compareArraysByProp.ts +56 -0
- package/src/helpers/extractProp.test.ts +34 -0
- package/src/helpers/extractProp.ts +17 -0
- package/src/helpers/floorToNumDecimals.test.ts +39 -0
- package/src/helpers/floorToNumDecimals.ts +13 -0
- package/src/helpers/forceNumIntoBounds.test.ts +34 -0
- package/src/helpers/forceNumIntoBounds.ts +19 -0
- package/src/helpers/genCSV.test.ts +77 -0
- package/src/helpers/genCSV.ts +87 -0
- package/src/helpers/genCommaList.test.ts +57 -0
- package/src/helpers/genCommaList.ts +21 -0
- package/src/helpers/getHumanReadableDate.test.ts +29 -0
- package/src/helpers/getHumanReadableDate.ts +36 -0
- package/src/helpers/getLocalTimeInfo.test.ts +48 -0
- package/src/helpers/getLocalTimeInfo.ts +58 -0
- package/src/helpers/getMonthName.test.ts +79 -0
- package/src/helpers/getMonthName.ts +29 -0
- package/src/helpers/getOrdinal.test.ts +84 -0
- package/src/helpers/getOrdinal.ts +14 -0
- package/src/helpers/getPartOfDay.test.ts +56 -0
- package/src/helpers/getPartOfDay.ts +20 -0
- package/src/helpers/getTimeInfoInET.test.ts +72 -0
- package/src/helpers/getTimeInfoInET.ts +79 -0
- package/src/helpers/getTimestampFromTimeInfoInET.ts +179 -0
- package/src/helpers/getWordCount.ts +26 -0
- package/src/helpers/idify.ts +24 -0
- package/src/helpers/onlyKeepLetters.ts +11 -0
- package/src/helpers/padDecimalZeros.ts +32 -0
- package/src/helpers/padZerosLeft.ts +21 -0
- package/src/helpers/parallelLimit.ts +63 -0
- package/src/helpers/prefixWithAOrAn.ts +29 -0
- package/src/helpers/roundToNumDecimals.ts +13 -0
- package/src/helpers/shuffleArray.ts +19 -0
- package/src/helpers/startMinWait.ts +33 -0
- package/src/helpers/stringsToHumanReadableList.ts +39 -0
- package/src/helpers/sum.ts +16 -0
- package/src/helpers/validators/ChicagoTitleCase.test.ts +85 -0
- package/src/helpers/validators/ChicagoTitleCase.ts +32 -0
- package/src/helpers/validators/findURL.test.ts +83 -0
- package/src/helpers/validators/findURL.ts +43 -0
- package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +18 -0
- package/src/helpers/validators/shared/helpers/validateRegex.ts +47 -0
- package/src/helpers/validators/shared/types/ValidationResult.ts +20 -0
- package/src/helpers/validators/validURL.test.ts +90 -0
- package/src/helpers/validators/validURL.ts +18 -0
- package/src/helpers/validators/validateEmail.test.ts +110 -0
- package/src/helpers/validators/validateEmail.ts +47 -0
- package/src/helpers/validators/validatePhoneNumber.test.ts +94 -0
- package/src/helpers/validators/validatePhoneNumber.ts +49 -0
- package/src/helpers/validators/validateString.test.ts +173 -0
- package/src/helpers/validators/validateString.ts +171 -0
- package/src/helpers/waitMs.ts +12 -0
- package/src/index.ts +139 -0
- package/src/types/CommonKitErrorCode.ts +13 -0
- package/src/types/DayOfWeek.ts +15 -0
- package/src/types/Log/LogMainInfo.ts +69 -0
- package/src/types/Log/LogSourceSpecificInfo.ts +25 -0
- package/src/types/Log/LogTypeSpecificInfo.ts +33 -0
- package/src/types/Log/index.ts +17 -0
- package/src/types/LogAction.ts +52 -0
- package/src/types/LogBuiltInMetadata.ts +19 -0
- package/src/types/LogFunction.ts +46 -0
- package/src/types/LogLevel.ts +11 -0
- package/src/types/LogMetadataContextMap.ts +15 -0
- package/src/types/LogMetadataTagMap.ts +9 -0
- package/src/types/LogMetadataTargetMap.ts +9 -0
- package/src/types/LogMetadataType.ts +16 -0
- package/src/types/LogSource.ts +12 -0
- package/src/types/LogType.ts +12 -0
- package/src/types/ParamType.ts +18 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,123 @@
|
|
|
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 constants
|
|
43
|
+
var ERROR_MESSAGES_1 = require("./shared/constants/ERROR_MESSAGES");
|
|
44
|
+
// Import function
|
|
45
|
+
var validatePhoneNumber_1 = __importDefault(require("./validatePhoneNumber"));
|
|
46
|
+
/*------------------------------------------------------------------------*/
|
|
47
|
+
/* ---------------------------- Valid Tests --------------------------- */
|
|
48
|
+
/*------------------------------------------------------------------------*/
|
|
49
|
+
var cleanedNumber = '1234567890';
|
|
50
|
+
var cleanedNumberExt = '11234567890';
|
|
51
|
+
var validPhoneNumbers = [
|
|
52
|
+
{
|
|
53
|
+
input: '1234567890',
|
|
54
|
+
cleaned: cleanedNumber,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
input: '(123)-456-7890',
|
|
58
|
+
cleaned: cleanedNumber,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
input: '123-456-7890',
|
|
62
|
+
cleaned: cleanedNumber,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
input: '(123)456-7890',
|
|
66
|
+
cleaned: cleanedNumber,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
input: '(123)4567890',
|
|
70
|
+
cleaned: cleanedNumber,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
input: ' 123456-7890 ',
|
|
74
|
+
cleaned: cleanedNumber,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
input: '+1 123 456 7890',
|
|
78
|
+
cleaned: cleanedNumberExt,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
input: '+1123456 7890',
|
|
82
|
+
cleaned: cleanedNumberExt,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
input: '+1(123)456-7890',
|
|
86
|
+
cleaned: cleanedNumberExt,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
test('Returns true for a given valid phone number and removes any non-digit characters.', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
validPhoneNumbers.forEach(function (pair) {
|
|
92
|
+
var validResponse = {
|
|
93
|
+
isValid: true,
|
|
94
|
+
cleanedValue: pair.cleaned,
|
|
95
|
+
};
|
|
96
|
+
expect((0, validatePhoneNumber_1.default)(pair.input)).toStrictEqual(validResponse);
|
|
97
|
+
});
|
|
98
|
+
return [2 /*return*/];
|
|
99
|
+
});
|
|
100
|
+
}); });
|
|
101
|
+
/*------------------------------------------------------------------------*/
|
|
102
|
+
/* ---------------------------- Invalid Tests --------------------------- */
|
|
103
|
+
/*------------------------------------------------------------------------*/
|
|
104
|
+
var invalidPhoneNumbers = [
|
|
105
|
+
'123456789',
|
|
106
|
+
'1234567894567890',
|
|
107
|
+
'1234-567-890',
|
|
108
|
+
'123456m78',
|
|
109
|
+
'123 4567 890',
|
|
110
|
+
];
|
|
111
|
+
var invalidResponse = {
|
|
112
|
+
isValid: false,
|
|
113
|
+
errorMessage: ERROR_MESSAGES_1.INVALID_PHONE_ERROR,
|
|
114
|
+
};
|
|
115
|
+
test('Returns false for a given valid phone number.', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
116
|
+
return __generator(this, function (_a) {
|
|
117
|
+
invalidPhoneNumbers.forEach(function (phoneNumber) {
|
|
118
|
+
expect((0, validatePhoneNumber_1.default)(phoneNumber)).toStrictEqual(invalidResponse);
|
|
119
|
+
});
|
|
120
|
+
return [2 /*return*/];
|
|
121
|
+
});
|
|
122
|
+
}); });
|
|
123
|
+
//# sourceMappingURL=validatePhoneNumber.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatePhoneNumber.test.js","sourceRoot":"","sources":["../../../src/helpers/validators/validatePhoneNumber.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,mBAAmB;AACnB,oEAAwE;AAExE,kBAAkB;AAClB,8EAAwD;AAExD,4EAA4E;AAC5E,0EAA0E;AAC1E,4EAA4E;AAE5E,IAAM,aAAa,GAAG,YAAY,CAAC;AACnC,IAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,IAAM,iBAAiB,GAAyC;IAC9D;QACE,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,aAAa;KACvB;IACD;QACE,KAAK,EAAE,gBAAgB;QACvB,OAAO,EAAE,aAAa;KACvB;IACD;QACE,KAAK,EAAE,cAAc;QACrB,OAAO,EAAE,aAAa;KACvB;IACD;QACE,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,aAAa;KACvB;IACD;QACE,KAAK,EAAE,cAAc;QACrB,OAAO,EAAE,aAAa;KACvB;IACD;QACE,KAAK,EAAE,kBAAkB;QACzB,OAAO,EAAE,aAAa;KACvB;IACD;QACE,KAAK,EAAE,iBAAiB;QACxB,OAAO,EAAE,gBAAgB;KAC1B;IACD;QACE,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,gBAAgB;KAC1B;IACD;QACE,KAAK,EAAE,iBAAiB;QACxB,OAAO,EAAE,gBAAgB;KAC1B;CACF,CAAC;AAEF,IAAI,CACF,mFAAmF,EACnF;;QACE,iBAAiB,CAAC,OAAO,CAAC,UAAC,IAAI;YAC7B,IAAM,aAAa,GAA6B;gBAC9C,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,IAAI,CAAC,OAAO;aAC3B,CAAC;YAEF,MAAM,CAAC,IAAA,6BAAmB,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;;;KACJ,CACF,CAAC;AAEF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,IAAM,mBAAmB,GAAa;IACpC,WAAW;IACX,kBAAkB;IAClB,cAAc;IACd,WAAW;IACX,cAAc;CACf,CAAC;AAEF,IAAM,eAAe,GAA6B;IAChD,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,oCAAmB;CAClC,CAAC;AAEF,IAAI,CACF,+CAA+C,EAC/C;;QACE,mBAAmB,CAAC,OAAO,CAAC,UAAC,WAAW;YACtC,MAAM,CAAC,IAAA,6BAAmB,EAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;;;KACJ,CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import ValidationResult from './shared/types/ValidationResult';
|
|
2
|
+
/**
|
|
3
|
+
* Determines whether a given input string is considered valid based on
|
|
4
|
+
* the provided requirements.
|
|
5
|
+
* @author Austen Money
|
|
6
|
+
* @param input input string
|
|
7
|
+
* @param opts options for validation
|
|
8
|
+
* @returns whether input is considered valid according to reqs - if
|
|
9
|
+
* valid, returns a cleaned version of input; if invalid, returns
|
|
10
|
+
* a string containing error messages describing which requirements
|
|
11
|
+
* were not met.
|
|
12
|
+
*/
|
|
13
|
+
declare const validateString: (input: string, opts: {
|
|
14
|
+
ignoreWhitespace?: boolean;
|
|
15
|
+
minLen?: number;
|
|
16
|
+
maxLen?: number;
|
|
17
|
+
lettersOnly?: boolean;
|
|
18
|
+
numbersOnly?: boolean;
|
|
19
|
+
regexTest?: RegExp;
|
|
20
|
+
regexDescription?: string;
|
|
21
|
+
}) => ValidationResult<string>;
|
|
22
|
+
export default validateString;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// Import helpers
|
|
7
|
+
var validateRegex_1 = __importDefault(require("./shared/helpers/validateRegex"));
|
|
8
|
+
var genCommaList_1 = __importDefault(require("../genCommaList"));
|
|
9
|
+
// Import constants
|
|
10
|
+
var ERROR_MESSAGES_1 = require("./shared/constants/ERROR_MESSAGES");
|
|
11
|
+
/*------------------------------------------------------------------------*/
|
|
12
|
+
/* ------------------------------ Constants ----------------------------- */
|
|
13
|
+
/*------------------------------------------------------------------------*/
|
|
14
|
+
// define minimum and maximum range for lowercase ASCII chars
|
|
15
|
+
var LOWERCASE_MIN = 65;
|
|
16
|
+
var LOWERCASE_MAX = 90;
|
|
17
|
+
// define minimum and maximum range for uppercase ASCII chars
|
|
18
|
+
var UPPERCASE_MIN = 97;
|
|
19
|
+
var UPPERCASE_MAX = 122;
|
|
20
|
+
// define minimum and maximum range for ASCII digits
|
|
21
|
+
var DIGIT_MIN = 48;
|
|
22
|
+
var DIGIT_MAX = 57;
|
|
23
|
+
/*------------------------------------------------------------------------*/
|
|
24
|
+
/* ---------------------------- Main Function --------------------------- */
|
|
25
|
+
/*------------------------------------------------------------------------*/
|
|
26
|
+
/**
|
|
27
|
+
* Determines whether a given input string is considered valid based on
|
|
28
|
+
* the provided requirements.
|
|
29
|
+
* @author Austen Money
|
|
30
|
+
* @param input input string
|
|
31
|
+
* @param opts options for validation
|
|
32
|
+
* @returns whether input is considered valid according to reqs - if
|
|
33
|
+
* valid, returns a cleaned version of input; if invalid, returns
|
|
34
|
+
* a string containing error messages describing which requirements
|
|
35
|
+
* were not met.
|
|
36
|
+
*/
|
|
37
|
+
var validateString = function (input, opts) {
|
|
38
|
+
// stores all invalid input errors
|
|
39
|
+
var errorMessages = [];
|
|
40
|
+
// contains version of input that will be returned
|
|
41
|
+
var cleanedValue = input;
|
|
42
|
+
// remove whitespace if required
|
|
43
|
+
if (opts.ignoreWhitespace) {
|
|
44
|
+
cleanedValue = input.replace(/\s+/g, '');
|
|
45
|
+
}
|
|
46
|
+
// apply max char requirement
|
|
47
|
+
if (opts.minLen) {
|
|
48
|
+
if (cleanedValue.length < opts.minLen) {
|
|
49
|
+
errorMessages.push(ERROR_MESSAGES_1.INVALID_STRING_ERRORS.MIN_LEN(opts.minLen));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// apply max char requirement
|
|
53
|
+
if (opts.maxLen) {
|
|
54
|
+
if (cleanedValue.length > opts.maxLen) {
|
|
55
|
+
errorMessages.push(ERROR_MESSAGES_1.INVALID_STRING_ERRORS.MAX_LEN(opts.maxLen));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// apply alphabetical requirement
|
|
59
|
+
if (opts.lettersOnly) {
|
|
60
|
+
// remove diacritics
|
|
61
|
+
cleanedValue = cleanedValue.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
62
|
+
var containsNonLetters = (cleanedValue
|
|
63
|
+
// split into characters
|
|
64
|
+
.split('')
|
|
65
|
+
// convert into character codes
|
|
66
|
+
.map(function (curr) {
|
|
67
|
+
return curr.charCodeAt(0);
|
|
68
|
+
})
|
|
69
|
+
// check for non-letters
|
|
70
|
+
.some(function (currCode) {
|
|
71
|
+
return (!(currCode >= LOWERCASE_MIN && currCode <= LOWERCASE_MAX)
|
|
72
|
+
&& !(currCode >= UPPERCASE_MIN && currCode <= UPPERCASE_MAX));
|
|
73
|
+
}));
|
|
74
|
+
if (containsNonLetters) {
|
|
75
|
+
errorMessages.push(ERROR_MESSAGES_1.INVALID_STRING_ERRORS.LETTERS_ONLY);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// apply numerical requirement
|
|
79
|
+
if (opts.numbersOnly) {
|
|
80
|
+
var containsNonNumbers = (cleanedValue
|
|
81
|
+
// split into characters
|
|
82
|
+
.split('')
|
|
83
|
+
// convert into character codes
|
|
84
|
+
.map(function (curr) {
|
|
85
|
+
return curr.charCodeAt(0);
|
|
86
|
+
})
|
|
87
|
+
// check for non-numbers
|
|
88
|
+
.some(function (currCode) {
|
|
89
|
+
return (!(currCode >= DIGIT_MIN && currCode <= DIGIT_MAX));
|
|
90
|
+
}));
|
|
91
|
+
if (containsNonNumbers) {
|
|
92
|
+
errorMessages.push(ERROR_MESSAGES_1.INVALID_STRING_ERRORS.NUMBERS_ONLY);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// apply regex requirement
|
|
96
|
+
if (opts.regexTest) {
|
|
97
|
+
var regex = opts.regexTest;
|
|
98
|
+
// validate and create customized error message if description is provided
|
|
99
|
+
var result = (0, validateRegex_1.default)({
|
|
100
|
+
input: cleanedValue,
|
|
101
|
+
regex: regex,
|
|
102
|
+
regexDescription: opts.regexDescription,
|
|
103
|
+
});
|
|
104
|
+
// if string did not pass regex validation, add error message
|
|
105
|
+
if (result.isValid === false) {
|
|
106
|
+
errorMessages.push(result.errorMessage);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// combine all error messages into one string to return
|
|
110
|
+
var errorMessage = "".concat(ERROR_MESSAGES_1.INVALID_STRING_ERRORS.MESSAGE_INTRO).concat((0, genCommaList_1.default)(errorMessages), ".");
|
|
111
|
+
return (
|
|
112
|
+
// if no error messages, string is valid; if not, it is invalid
|
|
113
|
+
errorMessages.length === 0
|
|
114
|
+
? {
|
|
115
|
+
isValid: true,
|
|
116
|
+
cleanedValue: cleanedValue,
|
|
117
|
+
}
|
|
118
|
+
: {
|
|
119
|
+
isValid: false,
|
|
120
|
+
errorMessage: errorMessage,
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
exports.default = validateString;
|
|
124
|
+
//# sourceMappingURL=validateString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateString.js","sourceRoot":"","sources":["../../../src/helpers/validators/validateString.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,163 @@
|
|
|
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 helpers
|
|
43
|
+
var genCommaList_1 = __importDefault(require("../genCommaList"));
|
|
44
|
+
// Import constants
|
|
45
|
+
var ERROR_MESSAGES_1 = require("./shared/constants/ERROR_MESSAGES");
|
|
46
|
+
// Import function
|
|
47
|
+
var validateString_1 = __importDefault(require("./validateString"));
|
|
48
|
+
/*------------------------------------------------------------------------*/
|
|
49
|
+
/* ---------------------------- Valid Tests --------------------------- */
|
|
50
|
+
/*------------------------------------------------------------------------*/
|
|
51
|
+
var validStrings = [
|
|
52
|
+
'users',
|
|
53
|
+
'username',
|
|
54
|
+
'MyValidString',
|
|
55
|
+
'HereisAnotherValidString',
|
|
56
|
+
'WoahAnotherValidStringIsHere',
|
|
57
|
+
];
|
|
58
|
+
var validReqs = [
|
|
59
|
+
{},
|
|
60
|
+
{
|
|
61
|
+
minLen: 5,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
minLen: 5,
|
|
65
|
+
maxLen: 30,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
minLen: 5,
|
|
69
|
+
maxLen: 30,
|
|
70
|
+
lettersOnly: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
minLen: 5,
|
|
74
|
+
maxLen: 30,
|
|
75
|
+
lettersOnly: true,
|
|
76
|
+
numbersOnly: false,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
minLen: 5,
|
|
80
|
+
maxLen: 30,
|
|
81
|
+
lettersOnly: true,
|
|
82
|
+
numbersOnly: false,
|
|
83
|
+
ignoreWhitespace: false,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
test('Returns true for a given valid string.', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
87
|
+
var validString, validResponse, validOpt;
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
validStrings.forEach(function (validString) {
|
|
90
|
+
validReqs.forEach(function (validReq) {
|
|
91
|
+
var validResponse = {
|
|
92
|
+
isValid: true,
|
|
93
|
+
cleanedValue: validString,
|
|
94
|
+
};
|
|
95
|
+
expect((0, validateString_1.default)(validString, validReq)).toStrictEqual(validResponse);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
validString = 'A string with whitespace!';
|
|
99
|
+
validResponse = {
|
|
100
|
+
isValid: true,
|
|
101
|
+
cleanedValue: 'Astringwithwhitespace!',
|
|
102
|
+
};
|
|
103
|
+
validOpt = {
|
|
104
|
+
maxLen: 22,
|
|
105
|
+
ignoreWhitespace: true,
|
|
106
|
+
};
|
|
107
|
+
expect((0, validateString_1.default)(validString, validOpt)).toStrictEqual(validResponse);
|
|
108
|
+
return [2 /*return*/];
|
|
109
|
+
});
|
|
110
|
+
}); });
|
|
111
|
+
/*------------------------------------------------------------------------*/
|
|
112
|
+
/* ---------------------------- Invalid Tests --------------------------- */
|
|
113
|
+
/*------------------------------------------------------------------------*/
|
|
114
|
+
var invalidStrings = [
|
|
115
|
+
{
|
|
116
|
+
input: 'ûšër',
|
|
117
|
+
reqs: {
|
|
118
|
+
minLen: 5,
|
|
119
|
+
lettersOnly: true,
|
|
120
|
+
},
|
|
121
|
+
error: [ERROR_MESSAGES_1.INVALID_STRING_ERRORS.MIN_LEN(5)],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
input: '123456789',
|
|
125
|
+
reqs: {
|
|
126
|
+
minLen: 10,
|
|
127
|
+
maxLen: 5,
|
|
128
|
+
lettersOnly: true,
|
|
129
|
+
},
|
|
130
|
+
error: [ERROR_MESSAGES_1.INVALID_STRING_ERRORS.MIN_LEN(10), ERROR_MESSAGES_1.INVALID_STRING_ERRORS.MAX_LEN(5), ERROR_MESSAGES_1.INVALID_STRING_ERRORS.LETTERS_ONLY],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
input: 'String with non-letters!!',
|
|
134
|
+
reqs: {
|
|
135
|
+
lettersOnly: true,
|
|
136
|
+
numbersOnly: true,
|
|
137
|
+
ignoreWhitespace: true,
|
|
138
|
+
},
|
|
139
|
+
error: [ERROR_MESSAGES_1.INVALID_STRING_ERRORS.LETTERS_ONLY, ERROR_MESSAGES_1.INVALID_STRING_ERRORS.NUMBERS_ONLY],
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
input: '12345678',
|
|
143
|
+
reqs: {
|
|
144
|
+
lettersOnly: true,
|
|
145
|
+
regexTest: /^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{4})(?: *x(\d+))?\s*$/,
|
|
146
|
+
regexDescription: 'should be a phone number',
|
|
147
|
+
},
|
|
148
|
+
error: [ERROR_MESSAGES_1.INVALID_STRING_ERRORS.LETTERS_ONLY, "".concat(ERROR_MESSAGES_1.INVALID_REGEX_ERROR, ": should be a phone number")],
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
test('Returns false for a given invalid string.', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
invalidStrings.forEach(function (triple) {
|
|
154
|
+
var invalidResponse = {
|
|
155
|
+
isValid: false,
|
|
156
|
+
errorMessage: "".concat(ERROR_MESSAGES_1.INVALID_STRING_ERRORS.MESSAGE_INTRO).concat((0, genCommaList_1.default)(triple.error), "."),
|
|
157
|
+
};
|
|
158
|
+
expect((0, validateString_1.default)(triple.input, triple.reqs)).toStrictEqual(invalidResponse);
|
|
159
|
+
});
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
});
|
|
162
|
+
}); });
|
|
163
|
+
//# sourceMappingURL=validateString.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateString.test.js","sourceRoot":"","sources":["../../../src/helpers/validators/validateString.test.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
+
if (ar || !(i in from)) {
|
|
41
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
+
ar[i] = from[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
/**
|
|
49
|
+
* Wait for a certain number of ms
|
|
50
|
+
* @author Gabe Abrams
|
|
51
|
+
* @param ms number of ms to wait
|
|
52
|
+
*/
|
|
53
|
+
var waitMs = function () {
|
|
54
|
+
var args_1 = [];
|
|
55
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
56
|
+
args_1[_i] = arguments[_i];
|
|
57
|
+
}
|
|
58
|
+
return __awaiter(void 0, __spreadArray([], args_1, true), void 0, function (ms) {
|
|
59
|
+
if (ms === void 0) { ms = 0; }
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
62
|
+
setTimeout(resolve, ms);
|
|
63
|
+
})];
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.default = waitMs;
|
|
68
|
+
//# sourceMappingURL=waitMs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waitMs.js","sourceRoot":"","sources":["../../src/helpers/waitMs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,IAAM,MAAM,GAAG;;;;;gFAAO,EAAM;QAAN,mBAAA,EAAA,MAAM;;YAC1B,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO;oBACzB,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC1B,CAAC,CAAC,EAAC;;;CACJ,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import ErrorWithCode from './errors/ErrorWithCode';
|
|
2
|
+
import MINUTE_IN_MS from './constants/MINUTE_IN_MS';
|
|
3
|
+
import HOUR_IN_MS from './constants/HOUR_IN_MS';
|
|
4
|
+
import DAY_IN_MS from './constants/DAY_IN_MS';
|
|
5
|
+
import LOG_REVIEW_ROUTE_PATH_PREFIX from './constants/LOG_REVIEW_ROUTE_PATH_PREFIX';
|
|
6
|
+
import LOG_ROUTE_PATH from './constants/LOG_ROUTE_PATH';
|
|
7
|
+
import LOG_REVIEW_STATUS_ROUTE from './constants/LOG_REVIEW_STATUS_ROUTE';
|
|
8
|
+
import LOG_REVIEW_GET_LOGS_ROUTE from './constants/LOG_REVIEW_GET_LOGS_ROUTE';
|
|
9
|
+
import SELECT_ADMIN_CHECK_ROUTE from './constants/SELECT_ADMIN_CHECK_ROUTE';
|
|
10
|
+
import abbreviate from './helpers/abbreviate';
|
|
11
|
+
import avg from './helpers/avg';
|
|
12
|
+
import ceilToNumDecimals from './helpers/ceilToNumDecimals';
|
|
13
|
+
import floorToNumDecimals from './helpers/floorToNumDecimals';
|
|
14
|
+
import forceNumIntoBounds from './helpers/forceNumIntoBounds';
|
|
15
|
+
import padDecimalZeros from './helpers/padDecimalZeros';
|
|
16
|
+
import padZerosLeft from './helpers/padZerosLeft';
|
|
17
|
+
import roundToNumDecimals from './helpers/roundToNumDecimals';
|
|
18
|
+
import sum from './helpers/sum';
|
|
19
|
+
import waitMs from './helpers/waitMs';
|
|
20
|
+
import getOrdinal from './helpers/getOrdinal';
|
|
21
|
+
import getTimeInfoInET from './helpers/getTimeInfoInET';
|
|
22
|
+
import startMinWait from './helpers/startMinWait';
|
|
23
|
+
import getHumanReadableDate from './helpers/getHumanReadableDate';
|
|
24
|
+
import getPartOfDay from './helpers/getPartOfDay';
|
|
25
|
+
import stringsToHumanReadableList from './helpers/stringsToHumanReadableList';
|
|
26
|
+
import onlyKeepLetters from './helpers/onlyKeepLetters';
|
|
27
|
+
import parallelLimit from './helpers/parallelLimit';
|
|
28
|
+
import getMonthName from './helpers/getMonthName';
|
|
29
|
+
import genCSV from './helpers/genCSV';
|
|
30
|
+
import extractProp from './helpers/extractProp';
|
|
31
|
+
import compareArraysByProp from './helpers/compareArraysByProp';
|
|
32
|
+
import getLocalTimeInfo from './helpers/getLocalTimeInfo';
|
|
33
|
+
import genCommaList from './helpers/genCommaList';
|
|
34
|
+
import validateEmail from './helpers/validators/validateEmail';
|
|
35
|
+
import validatePhoneNumber from './helpers/validators/validatePhoneNumber';
|
|
36
|
+
import validateString from './helpers/validators/validateString';
|
|
37
|
+
import idify from './helpers/idify';
|
|
38
|
+
import prefixWithAOrAn from './helpers/prefixWithAOrAn';
|
|
39
|
+
import everyAsync from './helpers/asyncArrayFunctions/everyAsync';
|
|
40
|
+
import filterAsync from './helpers/asyncArrayFunctions/filterAsync';
|
|
41
|
+
import forEachAsync from './helpers/asyncArrayFunctions/forEachAsync';
|
|
42
|
+
import mapAsync from './helpers/asyncArrayFunctions/mapAsync';
|
|
43
|
+
import someAsync from './helpers/asyncArrayFunctions/someAsync';
|
|
44
|
+
import capitalize from './helpers/capitalize';
|
|
45
|
+
import shuffleArray from './helpers/shuffleArray';
|
|
46
|
+
import getWordCount from './helpers/getWordCount';
|
|
47
|
+
import cloneDeep from './helpers/cloneDeep';
|
|
48
|
+
import getTimestampFromTimeInfoInET from './helpers/getTimestampFromTimeInfoInET';
|
|
49
|
+
import ParamType from './types/ParamType';
|
|
50
|
+
import DayOfWeek from './types/DayOfWeek';
|
|
51
|
+
import Log from './types/Log';
|
|
52
|
+
import LogType from './types/LogType';
|
|
53
|
+
import LogSource from './types/LogSource';
|
|
54
|
+
import LogAction from './types/LogAction';
|
|
55
|
+
import LogBuiltInMetadata from './types/LogBuiltInMetadata';
|
|
56
|
+
import LogMetadataType from './types/LogMetadataType';
|
|
57
|
+
import LogFunction from './types/LogFunction';
|
|
58
|
+
import LogTypeSpecificInfo from './types/Log/LogTypeSpecificInfo';
|
|
59
|
+
import LogMainInfo from './types/Log/LogMainInfo';
|
|
60
|
+
import LogSourceSpecificInfo from './types/Log/LogSourceSpecificInfo';
|
|
61
|
+
import LogLevel from './types/LogLevel';
|
|
62
|
+
import CommonKitErrorCode from './types/CommonKitErrorCode';
|
|
63
|
+
export { ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_ROUTE_PATH, LOG_REVIEW_STATUS_ROUTE, LOG_REVIEW_GET_LOGS_ROUTE, SELECT_ADMIN_CHECK_ROUTE, CommonKitErrorCode, ParamType, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, LogTypeSpecificInfo, LogMainInfo, LogSourceSpecificInfo, LogLevel, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, getWordCount, cloneDeep, getTimestampFromTimeInfoInET, };
|