zcw-shared 1.9.0 → 1.10.1
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/constants/colorPatterns.d.ts +8 -0
- package/dist/constants/colorPatterns.js +9 -1
- package/dist/constants/colorPatterns.js.map +1 -1
- package/dist/functions/color/detectColorFormat.js +11 -11
- package/dist/functions/color/detectColorFormat.js.map +1 -1
- package/dist/functions/color/extractColors.d.ts +1 -0
- package/dist/functions/color/extractColors.js +13 -79
- package/dist/functions/color/extractColors.js.map +1 -1
- package/package.json +2 -1
- package/references/xpath.d.ts +60 -0
- package/types/android-build.d.ts +2 -0
- package/types/uniapp-android-build.d.ts +2 -0
- package/dist/constants/namedColors.d.ts +0 -16
- package/dist/constants/namedColors.js +0 -17
- package/dist/constants/namedColors.js.map +0 -1
- package/dist/constants/softwareConfigs.d.ts +0 -14
- package/dist/constants/softwareConfigs.js +0 -156
- package/dist/constants/softwareConfigs.js.map +0 -1
- package/dist/functions/ag-grid/generateLicense.d.ts +0 -3
- package/dist/functions/ag-grid/generateLicense.js +0 -12
- package/dist/functions/ag-grid/generateLicense.js.map +0 -1
- package/dist/functions/altool/createAltoolClient.d.ts +0 -21
- package/dist/functions/altool/createAltoolClient.js +0 -53
- package/dist/functions/altool/createAltoolClient.js.map +0 -1
- package/dist/functions/altool/getAltoolAuth.d.ts +0 -2
- package/dist/functions/altool/getAltoolAuth.js +0 -8
- package/dist/functions/altool/getAltoolAuth.js.map +0 -1
- package/dist/functions/altool/getAppInfo.d.ts +0 -13
- package/dist/functions/altool/getAppInfo.js +0 -39
- package/dist/functions/altool/getAppInfo.js.map +0 -1
- package/dist/functions/altool/index.d.ts +0 -10
- package/dist/functions/altool/index.js +0 -6
- package/dist/functions/altool/index.js.map +0 -1
- package/dist/functions/altool/isApiKeyAuth.d.ts +0 -2
- package/dist/functions/altool/isApiKeyAuth.js +0 -4
- package/dist/functions/altool/isApiKeyAuth.js.map +0 -1
- package/dist/functions/altool/isCredentialsAuth.d.ts +0 -2
- package/dist/functions/altool/isCredentialsAuth.js +0 -4
- package/dist/functions/altool/isCredentialsAuth.js.map +0 -1
- package/dist/functions/altool/parseAppInfoOutput.d.ts +0 -2
- package/dist/functions/altool/parseAppInfoOutput.js +0 -55
- package/dist/functions/altool/parseAppInfoOutput.js.map +0 -1
- package/dist/functions/altool/parseValidationOutput.d.ts +0 -6
- package/dist/functions/altool/parseValidationOutput.js +0 -21
- package/dist/functions/altool/parseValidationOutput.js.map +0 -1
- package/dist/functions/altool/types.d.ts +0 -26
- package/dist/functions/altool/types.js +0 -7
- package/dist/functions/altool/types.js.map +0 -1
- package/dist/functions/altool/uploadApp.d.ts +0 -6
- package/dist/functions/altool/uploadApp.js +0 -36
- package/dist/functions/altool/uploadApp.js.map +0 -1
- package/dist/functions/altool/validateApp.d.ts +0 -17
- package/dist/functions/altool/validateApp.js +0 -40
- package/dist/functions/altool/validateApp.js.map +0 -1
- package/dist/functions/android/buildProject.d.ts +0 -12
- package/dist/functions/android/buildProject.js +0 -123
- package/dist/functions/android/buildProject.js.map +0 -1
- package/dist/functions/android/modifyGradle.d.ts +0 -17
- package/dist/functions/android/modifyGradle.js +0 -69
- package/dist/functions/android/modifyGradle.js.map +0 -1
- package/dist/functions/android/modifyManifest.d.ts +0 -23
- package/dist/functions/android/modifyManifest.js +0 -198
- package/dist/functions/android/modifyManifest.js.map +0 -1
- package/dist/functions/android/permission.d.ts +0 -30
- package/dist/functions/android/permission.js +0 -65
- package/dist/functions/android/permission.js.map +0 -1
- package/dist/functions/base64/strToBase64.d.ts +0 -2
- package/dist/functions/base64/strToBase64.js +0 -6
- package/dist/functions/base64/strToBase64.js.map +0 -1
- package/dist/functions/color/colorValidation.d.ts +0 -11
- package/dist/functions/color/colorValidation.js +0 -35
- package/dist/functions/color/colorValidation.js.map +0 -1
- package/dist/functions/color/deduplicateColors.d.ts +0 -4
- package/dist/functions/color/deduplicateColors.js +0 -40
- package/dist/functions/color/deduplicateColors.js.map +0 -1
- package/dist/functions/color-converter/COLOR_PATTERNS.d.ts +0 -2
- package/dist/functions/color-converter/COLOR_PATTERNS.js +0 -9
- package/dist/functions/color-converter/COLOR_PATTERNS.js.map +0 -1
- package/dist/functions/color-converter/colorPatterns.d.ts +0 -4
- package/dist/functions/color-converter/colorPatterns.js +0 -41
- package/dist/functions/color-converter/colorPatterns.js.map +0 -1
- package/dist/functions/color-converter/convertColor.d.ts +0 -6
- package/dist/functions/color-converter/convertColor.js +0 -12
- package/dist/functions/color-converter/convertColor.js.map +0 -1
- package/dist/functions/color-converter/createColorReference.d.ts +0 -2
- package/dist/functions/color-converter/createColorReference.js +0 -12
- package/dist/functions/color-converter/createColorReference.js.map +0 -1
- package/dist/functions/color-converter/detectColorFormat.d.ts +0 -2
- package/dist/functions/color-converter/detectColorFormat.js +0 -19
- package/dist/functions/color-converter/detectColorFormat.js.map +0 -1
- package/dist/functions/color-converter/extractColors.d.ts +0 -3
- package/dist/functions/color-converter/extractColors.js +0 -16
- package/dist/functions/color-converter/extractColors.js.map +0 -1
- package/dist/functions/color-converter/extractColorsFromLine.d.ts +0 -2
- package/dist/functions/color-converter/extractColorsFromLine.js +0 -18
- package/dist/functions/color-converter/extractColorsFromLine.js.map +0 -1
- package/dist/functions/color-converter/extractColorsGeneric.d.ts +0 -2
- package/dist/functions/color-converter/extractColorsGeneric.js +0 -12
- package/dist/functions/color-converter/extractColorsGeneric.js.map +0 -1
- package/dist/functions/color-converter/extractCssVariableReferences.d.ts +0 -2
- package/dist/functions/color-converter/extractCssVariableReferences.js +0 -15
- package/dist/functions/color-converter/extractCssVariableReferences.js.map +0 -1
- package/dist/functions/color-converter/extractThirdPartyVariableReferences.d.ts +0 -2
- package/dist/functions/color-converter/extractThirdPartyVariableReferences.js +0 -15
- package/dist/functions/color-converter/extractThirdPartyVariableReferences.js.map +0 -1
- package/dist/functions/color-converter/formatColorOutput.d.ts +0 -5
- package/dist/functions/color-converter/formatColorOutput.js +0 -48
- package/dist/functions/color-converter/formatColorOutput.js.map +0 -1
- package/dist/functions/color-converter/getColorPatterns.d.ts +0 -2
- package/dist/functions/color-converter/getColorPatterns.js +0 -11
- package/dist/functions/color-converter/getColorPatterns.js.map +0 -1
- package/dist/functions/color-converter/getNamedColorMap.d.ts +0 -2
- package/dist/functions/color-converter/getNamedColorMap.js +0 -19
- package/dist/functions/color-converter/getNamedColorMap.js.map +0 -1
- package/dist/functions/color-converter/hexToRgb.d.ts +0 -2
- package/dist/functions/color-converter/hexToRgb.js +0 -42
- package/dist/functions/color-converter/hexToRgb.js.map +0 -1
- package/dist/functions/color-converter/hslToRgb.d.ts +0 -2
- package/dist/functions/color-converter/hslToRgb.js +0 -78
- package/dist/functions/color-converter/hslToRgb.js.map +0 -1
- package/dist/functions/color-converter/hslToRgbInternal.d.ts +0 -2
- package/dist/functions/color-converter/hslToRgbInternal.js +0 -24
- package/dist/functions/color-converter/hslToRgbInternal.js.map +0 -1
- package/dist/functions/color-converter/hueToRgb.d.ts +0 -1
- package/dist/functions/color-converter/hueToRgb.js +0 -14
- package/dist/functions/color-converter/hueToRgb.js.map +0 -1
- package/dist/functions/color-converter/isColorValue.d.ts +0 -2
- package/dist/functions/color-converter/isColorValue.js +0 -79
- package/dist/functions/color-converter/isColorValue.js.map +0 -1
- package/dist/functions/color-converter/isValidColorValue.d.ts +0 -1
- package/dist/functions/color-converter/isValidColorValue.js +0 -4
- package/dist/functions/color-converter/isValidColorValue.js.map +0 -1
- package/dist/functions/color-converter/isValidHslColor.d.ts +0 -2
- package/dist/functions/color-converter/isValidHslColor.js +0 -14
- package/dist/functions/color-converter/isValidHslColor.js.map +0 -1
- package/dist/functions/color-converter/isValidRgbColor.d.ts +0 -2
- package/dist/functions/color-converter/isValidRgbColor.js +0 -14
- package/dist/functions/color-converter/isValidRgbColor.js.map +0 -1
- package/dist/functions/color-converter/normalizeColor.d.ts +0 -1
- package/dist/functions/color-converter/normalizeColor.js +0 -49
- package/dist/functions/color-converter/normalizeColor.js.map +0 -1
- package/dist/functions/color-converter/normalizeColorInput.d.ts +0 -6
- package/dist/functions/color-converter/normalizeColorInput.js +0 -94
- package/dist/functions/color-converter/normalizeColorInput.js.map +0 -1
- package/dist/functions/color-converter/parseColorString.d.ts +0 -12
- package/dist/functions/color-converter/parseColorString.js +0 -89
- package/dist/functions/color-converter/parseColorString.js.map +0 -1
- package/dist/functions/color-converter/parseCssVariables.d.ts +0 -2
- package/dist/functions/color-converter/parseCssVariables.js +0 -19
- package/dist/functions/color-converter/parseCssVariables.js.map +0 -1
- package/dist/functions/color-converter/parseHexColor.d.ts +0 -6
- package/dist/functions/color-converter/parseHexColor.js +0 -42
- package/dist/functions/color-converter/parseHexColor.js.map +0 -1
- package/dist/functions/color-converter/rgbToHex.d.ts +0 -2
- package/dist/functions/color-converter/rgbToHex.js +0 -65
- package/dist/functions/color-converter/rgbToHex.js.map +0 -1
- package/dist/functions/color-converter/rgbToHslInternal.d.ts +0 -2
- package/dist/functions/color-converter/rgbToHslInternal.js +0 -31
- package/dist/functions/color-converter/rgbToHslInternal.js.map +0 -1
- package/dist/functions/color-converter/standardizeColor.d.ts +0 -1
- package/dist/functions/color-converter/standardizeColor.js +0 -147
- package/dist/functions/color-converter/standardizeColor.js.map +0 -1
- package/dist/functions/css/extractCssVariables.d.ts +0 -12
- package/dist/functions/css/extractCssVariables.js +0 -53
- package/dist/functions/css/extractCssVariables.js.map +0 -1
- package/dist/functions/debug/createDebugger.d.ts +0 -21
- package/dist/functions/debug/createDebugger.js +0 -89
- package/dist/functions/debug/createDebugger.js.map +0 -1
- package/dist/functions/desensitize/desensitizeName.d.ts +0 -1
- package/dist/functions/desensitize/desensitizeName.js +0 -8
- package/dist/functions/desensitize/desensitizeName.js.map +0 -1
- package/dist/functions/desensitize/desensitizePhone.d.ts +0 -1
- package/dist/functions/desensitize/desensitizePhone.js +0 -8
- package/dist/functions/desensitize/desensitizePhone.js.map +0 -1
- package/dist/functions/dom/detectOverflow.d.ts +0 -8
- package/dist/functions/dom/detectOverflow.js +0 -17
- package/dist/functions/dom/detectOverflow.js.map +0 -1
- package/dist/functions/dom/getElementRect.d.ts +0 -3
- package/dist/functions/dom/getElementRect.js +0 -14
- package/dist/functions/dom/getElementRect.js.map +0 -1
- package/dist/functions/dom/getRelativePosition.d.ts +0 -3
- package/dist/functions/dom/getRelativePosition.js +0 -14
- package/dist/functions/dom/getRelativePosition.js.map +0 -1
- package/dist/functions/dom/getViewportRect.d.ts +0 -3
- package/dist/functions/dom/getViewportRect.js +0 -15
- package/dist/functions/dom/getViewportRect.js.map +0 -1
- package/dist/functions/dom/getViewportSize.d.ts +0 -5
- package/dist/functions/dom/getViewportSize.js +0 -7
- package/dist/functions/dom/getViewportSize.js.map +0 -1
- package/dist/functions/image/generateMacIcons.d.ts +0 -6
- package/dist/functions/image/generateMacIcons.js +0 -15
- package/dist/functions/image/generateMacIcons.js.map +0 -1
- package/dist/functions/image/generateMacTrayIcon.d.ts +0 -7
- package/dist/functions/image/generateMacTrayIcon.js +0 -15
- package/dist/functions/image/generateMacTrayIcon.js.map +0 -1
- package/dist/functions/image/generatePaddedImage.d.ts +0 -3
- package/dist/functions/image/generatePaddedImage.js +0 -14
- package/dist/functions/image/generatePaddedImage.js.map +0 -1
- package/dist/functions/image/generatePwaIcons.d.ts +0 -6
- package/dist/functions/image/generatePwaIcons.js +0 -15
- package/dist/functions/image/generatePwaIcons.js.map +0 -1
- package/dist/functions/image/generateRoundedImage.d.ts +0 -3
- package/dist/functions/image/generateRoundedImage.js +0 -17
- package/dist/functions/image/generateRoundedImage.js.map +0 -1
- package/dist/functions/ipc/dispatchIpcRequest.d.ts +0 -6
- package/dist/functions/ipc/dispatchIpcRequest.js +0 -10
- package/dist/functions/ipc/dispatchIpcRequest.js.map +0 -1
- package/dist/functions/software/buildPathExecutables.d.ts +0 -1
- package/dist/functions/software/buildPathExecutables.js +0 -14
- package/dist/functions/software/buildPathExecutables.js.map +0 -1
- package/dist/functions/software/buildSoftwarePaths.d.ts +0 -2
- package/dist/functions/software/buildSoftwarePaths.js +0 -22
- package/dist/functions/software/buildSoftwarePaths.js.map +0 -1
- package/dist/functions/software/createConfigGenerator.d.ts +0 -8
- package/dist/functions/software/createConfigGenerator.js +0 -13
- package/dist/functions/software/createConfigGenerator.js.map +0 -1
- package/dist/functions/software/detectPlatform.d.ts +0 -2
- package/dist/functions/software/detectPlatform.js +0 -9
- package/dist/functions/software/detectPlatform.js.map +0 -1
- package/dist/functions/software/find.d.ts +0 -2
- package/dist/functions/software/find.js +0 -12
- package/dist/functions/software/find.js.map +0 -1
- package/dist/functions/software/findSoftware.d.ts +0 -13
- package/dist/functions/software/findSoftware.js +0 -41
- package/dist/functions/software/findSoftware.js.map +0 -1
- package/dist/functions/software/findSoftwareWithGenerator.d.ts +0 -3
- package/dist/functions/software/findSoftwareWithGenerator.js +0 -8
- package/dist/functions/software/findSoftwareWithGenerator.js.map +0 -1
- package/dist/functions/software/getConfigGenerator.d.ts +0 -2
- package/dist/functions/software/getConfigGenerator.js +0 -10
- package/dist/functions/software/getConfigGenerator.js.map +0 -1
- package/dist/functions/software/getEnvironmentSoftwarePath.d.ts +0 -1
- package/dist/functions/software/getEnvironmentSoftwarePath.js +0 -8
- package/dist/functions/software/getEnvironmentSoftwarePath.js.map +0 -1
- package/dist/functions/software/getSupportedSoftware.d.ts +0 -1
- package/dist/functions/software/getSupportedSoftware.js +0 -5
- package/dist/functions/software/getSupportedSoftware.js.map +0 -1
- package/dist/functions/software/parseEnvironmentPaths.d.ts +0 -1
- package/dist/functions/software/parseEnvironmentPaths.js +0 -11
- package/dist/functions/software/parseEnvironmentPaths.js.map +0 -1
- package/dist/functions/software/softwareConfigs.d.ts +0 -2
- package/dist/functions/software/softwareConfigs.js +0 -148
- package/dist/functions/software/softwareConfigs.js.map +0 -1
- package/dist/functions/software/softwareNameMap.d.ts +0 -1
- package/dist/functions/software/softwareNameMap.js +0 -9
- package/dist/functions/software/softwareNameMap.js.map +0 -1
- package/dist/functions/software/types.d.ts +0 -11
- package/dist/functions/software/types.js +0 -2
- package/dist/functions/software/types.js.map +0 -1
- package/dist/functions/string/base64.d.ts +0 -2
- package/dist/functions/string/base64.js +0 -6
- package/dist/functions/string/base64.js.map +0 -1
- package/dist/functions/string/camelCase.d.ts +0 -1
- package/dist/functions/string/camelCase.js +0 -8
- package/dist/functions/string/camelCase.js.map +0 -1
- package/dist/functions/string/capitalize.d.ts +0 -1
- package/dist/functions/string/capitalize.js +0 -6
- package/dist/functions/string/capitalize.js.map +0 -1
- package/dist/functions/string/caseConverter.d.ts +0 -19
- package/dist/functions/string/caseConverter.js +0 -94
- package/dist/functions/string/caseConverter.js.map +0 -1
- package/dist/functions/string/desensitize.d.ts +0 -13
- package/dist/functions/string/desensitize.js +0 -107
- package/dist/functions/string/desensitize.js.map +0 -1
- package/dist/functions/string/escape.d.ts +0 -1
- package/dist/functions/string/escape.js +0 -13
- package/dist/functions/string/escape.js.map +0 -1
- package/dist/functions/string/htmlEscape.d.ts +0 -20
- package/dist/functions/string/htmlEscape.js +0 -80
- package/dist/functions/string/htmlEscape.js.map +0 -1
- package/dist/functions/string/kebabCase.d.ts +0 -1
- package/dist/functions/string/kebabCase.js +0 -10
- package/dist/functions/string/kebabCase.js.map +0 -1
- package/dist/functions/string/levenshtein.d.ts +0 -1
- package/dist/functions/string/levenshtein.js +0 -27
- package/dist/functions/string/levenshtein.js.map +0 -1
- package/dist/functions/string/mask.d.ts +0 -1
- package/dist/functions/string/mask.js +0 -40
- package/dist/functions/string/mask.js.map +0 -1
- package/dist/functions/string/normalize.d.ts +0 -8
- package/dist/functions/string/normalize.js +0 -37
- package/dist/functions/string/normalize.js.map +0 -1
- package/dist/functions/string/pad.d.ts +0 -13
- package/dist/functions/string/pad.js +0 -50
- package/dist/functions/string/pad.js.map +0 -1
- package/dist/functions/string/padEnd.d.ts +0 -1
- package/dist/functions/string/padEnd.js +0 -8
- package/dist/functions/string/padEnd.js.map +0 -1
- package/dist/functions/string/padStart.d.ts +0 -1
- package/dist/functions/string/padStart.js +0 -8
- package/dist/functions/string/padStart.js.map +0 -1
- package/dist/functions/string/palindrome.d.ts +0 -3
- package/dist/functions/string/palindrome.js +0 -15
- package/dist/functions/string/palindrome.js.map +0 -1
- package/dist/functions/string/pascalCase.d.ts +0 -1
- package/dist/functions/string/pascalCase.js +0 -8
- package/dist/functions/string/pascalCase.js.map +0 -1
- package/dist/functions/string/similarity.d.ts +0 -1
- package/dist/functions/string/similarity.js +0 -13
- package/dist/functions/string/similarity.js.map +0 -1
- package/dist/functions/string/snakeCase.d.ts +0 -1
- package/dist/functions/string/snakeCase.js +0 -10
- package/dist/functions/string/snakeCase.js.map +0 -1
- package/dist/functions/string/template.d.ts +0 -4
- package/dist/functions/string/template.js +0 -21
- package/dist/functions/string/template.js.map +0 -1
- package/dist/functions/string/unescape.d.ts +0 -1
- package/dist/functions/string/unescape.js +0 -13
- package/dist/functions/string/unescape.js.map +0 -1
- package/dist/functions/string/wordCount.d.ts +0 -5
- package/dist/functions/string/wordCount.js +0 -11
- package/dist/functions/string/wordCount.js.map +0 -1
- package/dist/functions/tencent-cloud/getSecret.d.ts +0 -6
- package/dist/functions/tencent-cloud/getSecret.js +0 -18
- package/dist/functions/tencent-cloud/getSecret.js.map +0 -1
- package/dist/functions/uniapp/app-plus/androidProjectConfigSteps.d.ts +0 -13
- package/dist/functions/uniapp/app-plus/androidProjectConfigSteps.js +0 -175
- package/dist/functions/uniapp/app-plus/androidProjectConfigSteps.js.map +0 -1
- package/dist/functions/uniapp/app-plus/androidProjectStrategy.d.ts +0 -19
- package/dist/functions/uniapp/app-plus/androidProjectStrategy.js +0 -55
- package/dist/functions/uniapp/app-plus/androidProjectStrategy.js.map +0 -1
- package/dist/functions/uniapp/app-plus/buildAndroidApp.d.ts +0 -2
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js +0 -149
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js.map +0 -1
- package/dist/functions/uniapp/app-plus/buildAndroidProject.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/buildAndroidProject.js +0 -60
- package/dist/functions/uniapp/app-plus/buildAndroidProject.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureAndroidManifest.d.ts +0 -5
- package/dist/functions/uniapp/app-plus/configureAndroidManifest.js +0 -51
- package/dist/functions/uniapp/app-plus/configureAndroidManifest.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureAndroidProject.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/configureAndroidProject.js +0 -63
- package/dist/functions/uniapp/app-plus/configureAndroidProject.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureBuildGradle.d.ts +0 -9
- package/dist/functions/uniapp/app-plus/configureBuildGradle.js +0 -57
- package/dist/functions/uniapp/app-plus/configureBuildGradle.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureDcloudControl.d.ts +0 -5
- package/dist/functions/uniapp/app-plus/configureDcloudControl.js +0 -34
- package/dist/functions/uniapp/app-plus/configureDcloudControl.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureStrings.d.ts +0 -5
- package/dist/functions/uniapp/app-plus/configureStrings.js +0 -42
- package/dist/functions/uniapp/app-plus/configureStrings.js.map +0 -1
- package/dist/functions/uniapp/app-plus/copyAppResources.d.ts +0 -8
- package/dist/functions/uniapp/app-plus/copyAppResources.js +0 -25
- package/dist/functions/uniapp/app-plus/copyAppResources.js.map +0 -1
- package/dist/functions/uniapp/app-plus/copyDirectory.d.ts +0 -2
- package/dist/functions/uniapp/app-plus/copyDirectory.js +0 -18
- package/dist/functions/uniapp/app-plus/copyDirectory.js.map +0 -1
- package/dist/functions/uniapp/app-plus/generateUniAppResources.d.ts +0 -2
- package/dist/functions/uniapp/app-plus/generateUniAppResources.js +0 -35
- package/dist/functions/uniapp/app-plus/generateUniAppResources.js.map +0 -1
- package/dist/functions/uniapp/app-plus/parseManifest.d.ts +0 -14
- package/dist/functions/uniapp/app-plus/parseManifest.js +0 -44
- package/dist/functions/uniapp/app-plus/parseManifest.js.map +0 -1
- package/dist/functions/uniapp/app-plus/validateOptions.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/validateOptions.js +0 -10
- package/dist/functions/uniapp/app-plus/validateOptions.js.map +0 -1
- package/dist/functions/uniapp/build.d.ts +0 -20
- package/dist/functions/uniapp/build.js +0 -84
- package/dist/functions/uniapp/build.js.map +0 -1
- package/dist/functions/uniapp/detectAndroidProjectStructure.d.ts +0 -7
- package/dist/functions/uniapp/detectAndroidProjectStructure.js +0 -30
- package/dist/functions/uniapp/detectAndroidProjectStructure.js.map +0 -1
- package/dist/functions/uniapp/detectProjectType.d.ts +0 -16
- package/dist/functions/uniapp/detectProjectType.js +0 -68
- package/dist/functions/uniapp/detectProjectType.js.map +0 -1
- package/dist/functions/uniapp/parseManifest.d.ts +0 -12
- package/dist/functions/uniapp/parseManifest.js +0 -46
- package/dist/functions/uniapp/parseManifest.js.map +0 -1
- package/dist/functions/uniapp/waitForPages.d.ts +0 -3
- package/dist/functions/uniapp/waitForPages.js +0 -20
- package/dist/functions/uniapp/waitForPages.js.map +0 -1
- package/dist/functions/utils/compose.d.ts +0 -1
- package/dist/functions/utils/compose.js +0 -10
- package/dist/functions/utils/compose.js.map +0 -1
- package/dist/functions/utils/cond.d.ts +0 -1
- package/dist/functions/utils/cond.js +0 -15
- package/dist/functions/utils/cond.js.map +0 -1
- package/dist/functions/utils/curry.d.ts +0 -1
- package/dist/functions/utils/curry.js +0 -13
- package/dist/functions/utils/curry.js.map +0 -1
- package/dist/functions/utils/debounce.d.ts +0 -1
- package/dist/functions/utils/debounce.js +0 -13
- package/dist/functions/utils/debounce.js.map +0 -1
- package/dist/functions/utils/evolve.d.ts +0 -3
- package/dist/functions/utils/evolve.js +0 -15
- package/dist/functions/utils/evolve.js.map +0 -1
- package/dist/functions/utils/flow.d.ts +0 -1
- package/dist/functions/utils/flow.js +0 -14
- package/dist/functions/utils/flow.js.map +0 -1
- package/dist/functions/utils/generateExports.d.ts +0 -16
- package/dist/functions/utils/generateExports.js +0 -34
- package/dist/functions/utils/generateExports.js.map +0 -1
- package/dist/functions/utils/isType.d.ts +0 -11
- package/dist/functions/utils/isType.js +0 -30
- package/dist/functions/utils/isType.js.map +0 -1
- package/dist/functions/utils/memoize.d.ts +0 -1
- package/dist/functions/utils/memoize.js +0 -13
- package/dist/functions/utils/memoize.js.map +0 -1
- package/dist/functions/utils/once.d.ts +0 -1
- package/dist/functions/utils/once.js +0 -13
- package/dist/functions/utils/once.js.map +0 -1
- package/dist/functions/utils/partial.d.ts +0 -1
- package/dist/functions/utils/partial.js +0 -13
- package/dist/functions/utils/partial.js.map +0 -1
- package/dist/functions/utils/pipe.d.ts +0 -1
- package/dist/functions/utils/pipe.js +0 -10
- package/dist/functions/utils/pipe.js.map +0 -1
- package/dist/functions/utils/retryWithBackoff.d.ts +0 -9
- package/dist/functions/utils/retryWithBackoff.js +0 -30
- package/dist/functions/utils/retryWithBackoff.js.map +0 -1
- package/dist/functions/utils/tap.d.ts +0 -1
- package/dist/functions/utils/tap.js +0 -14
- package/dist/functions/utils/tap.js.map +0 -1
- package/dist/functions/utils/throttle.d.ts +0 -1
- package/dist/functions/utils/throttle.js +0 -11
- package/dist/functions/utils/throttle.js.map +0 -1
- package/dist/functions/utils/until.d.ts +0 -1
- package/dist/functions/utils/until.js +0 -10
- package/dist/functions/utils/until.js.map +0 -1
- package/dist/functions/utils/validate.d.ts +0 -8
- package/dist/functions/utils/validate.js +0 -45
- package/dist/functions/utils/validate.js.map +0 -1
- package/dist/functions/utils/walk.d.ts +0 -11
- package/dist/functions/utils/walk.js +0 -27
- package/dist/functions/utils/walk.js.map +0 -1
- package/dist/functions/vue/checkVueType.d.ts +0 -8
- package/dist/functions/vue/checkVueType.js +0 -29
- package/dist/functions/vue/checkVueType.js.map +0 -1
- package/dist/functions/vue/deduplicateColors.d.ts +0 -2
- package/dist/functions/vue/deduplicateColors.js +0 -13
- package/dist/functions/vue/deduplicateColors.js.map +0 -1
- package/dist/functions/vue/dynamicMount.d.ts +0 -15
- package/dist/functions/vue/dynamicMount.js +0 -25
- package/dist/functions/vue/dynamicMount.js.map +0 -1
- package/dist/functions/vue/filterSections.d.ts +0 -2
- package/dist/functions/vue/filterSections.js +0 -11
- package/dist/functions/vue/filterSections.js.map +0 -1
- package/dist/functions/vue/isVNode.d.ts +0 -2
- package/dist/functions/vue/isVNode.js +0 -6
- package/dist/functions/vue/isVNode.js.map +0 -1
- package/dist/functions/vue/isVueComponent.d.ts +0 -2
- package/dist/functions/vue/isVueComponent.js +0 -6
- package/dist/functions/vue/isVueComponent.js.map +0 -1
- package/dist/functions/vue/parseVueFile.d.ts +0 -2
- package/dist/functions/vue/parseVueFile.js +0 -53
- package/dist/functions/vue/parseVueFile.js.map +0 -1
- package/dist/functions/vue/processVueFile.d.ts +0 -3
- package/dist/functions/vue/processVueFile.js +0 -26
- package/dist/functions/vue/processVueFile.js.map +0 -1
- package/dist/functions/vue/saveVueSection.d.ts +0 -2
- package/dist/functions/vue/saveVueSection.js +0 -11
- package/dist/functions/vue/saveVueSection.js.map +0 -1
- package/dist/functions/wechat/miniapp/downloadFile.d.ts +0 -2
- package/dist/functions/wechat/miniapp/downloadFile.js +0 -39
- package/dist/functions/wechat/miniapp/downloadFile.js.map +0 -1
- package/dist/functions/xml/modifyXml.d.ts +0 -11
- package/dist/functions/xml/modifyXml.js +0 -46
- package/dist/functions/xml/modifyXml.js.map +0 -1
- package/dist/hooks/useAi.d.ts +0 -27
- package/dist/hooks/useAi.js +0 -163
- package/dist/hooks/useAi.js.map +0 -1
- package/dist/hooks/useAltool.d.ts +0 -39
- package/dist/hooks/useAltool.js +0 -350
- package/dist/hooks/useAltool.js.map +0 -1
- package/dist/hooks/useCache.d.ts +0 -18
- package/dist/hooks/useCache.js +0 -82
- package/dist/hooks/useCache.js.map +0 -1
- package/dist/hooks/useFetch.d.ts +0 -3
- package/dist/hooks/useFetch.js +0 -154
- package/dist/hooks/useFetch.js.map +0 -1
- package/dist/hooks/useLocalStorage.d.ts +0 -4
- package/dist/hooks/useLocalStorage.js +0 -100
- package/dist/hooks/useLocalStorage.js.map +0 -1
- package/dist/hooks/usePluginSystem.d.ts +0 -11
- package/dist/hooks/usePluginSystem.js +0 -34
- package/dist/hooks/usePluginSystem.js.map +0 -1
- package/dist/hooks/useRequest.d.ts +0 -3
- package/dist/hooks/useRequest.js +0 -139
- package/dist/hooks/useRequest.js.map +0 -1
- package/dist/hooks/useSessionStorage.d.ts +0 -4
- package/dist/hooks/useSessionStorage.js +0 -100
- package/dist/hooks/useSessionStorage.js.map +0 -1
- package/dist/hooks/useStorage.d.ts +0 -10
- package/dist/hooks/useStorage.js +0 -62
- package/dist/hooks/useStorage.js.map +0 -1
- package/dist/hooks/useStorageWithIndexedDB.d.ts +0 -4
- package/dist/hooks/useStorageWithIndexedDB.js +0 -119
- package/dist/hooks/useStorageWithIndexedDB.js.map +0 -1
- package/dist/hooks/useWASM.d.ts +0 -4
- package/dist/hooks/useWASM.js +0 -263
- package/dist/hooks/useWASM.js.map +0 -1
- package/dist/hooks/useWebWorker.d.ts +0 -25
- package/dist/hooks/useWebWorker.js +0 -209
- package/dist/hooks/useWebWorker.js.map +0 -1
- package/dist/hooks/useWorkerFunction.d.ts +0 -22
- package/dist/hooks/useWorkerFunction.js +0 -191
- package/dist/hooks/useWorkerFunction.js.map +0 -1
- package/dist/hooks/useWorkerPool.d.ts +0 -30
- package/dist/hooks/useWorkerPool.js +0 -242
- package/dist/hooks/useWorkerPool.js.map +0 -1
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { capitalize } from './capitalize';
|
|
2
|
-
export function caseConverter(str, options = {}, returnDetails = false) {
|
|
3
|
-
const { targetCase = 'camel', preserveConsecutiveUppercase = false } = options;
|
|
4
|
-
if (!str) {
|
|
5
|
-
const emptyResult = {
|
|
6
|
-
original: str,
|
|
7
|
-
camelCase: str,
|
|
8
|
-
pascalCase: str,
|
|
9
|
-
kebabCase: str,
|
|
10
|
-
snakeCase: str,
|
|
11
|
-
constantCase: str,
|
|
12
|
-
dotCase: str,
|
|
13
|
-
pathCase: str,
|
|
14
|
-
sentenceCase: str,
|
|
15
|
-
titleCase: str,
|
|
16
|
-
detectedCase: 'mixed'
|
|
17
|
-
};
|
|
18
|
-
return returnDetails ? emptyResult : str;
|
|
19
|
-
}
|
|
20
|
-
const detectedCase = detectCase(str);
|
|
21
|
-
const words = splitIntoWords(str, preserveConsecutiveUppercase);
|
|
22
|
-
const camelCase = words.map((word, index) => index === 0 ? word.toLowerCase() : capitalize(word.toLowerCase())).join('');
|
|
23
|
-
const pascalCase = words.map(word => capitalize(word.toLowerCase())).join('');
|
|
24
|
-
const kebabCase = words.map(word => word.toLowerCase()).join('-');
|
|
25
|
-
const snakeCase = words.map(word => word.toLowerCase()).join('_');
|
|
26
|
-
const constantCase = words.map(word => word.toUpperCase()).join('_');
|
|
27
|
-
const dotCase = words.map(word => word.toLowerCase()).join('.');
|
|
28
|
-
const pathCase = words.map(word => word.toLowerCase()).join('/');
|
|
29
|
-
const sentenceCase = words.map((word, index) => index === 0 ? capitalize(word.toLowerCase()) : word.toLowerCase()).join(' ');
|
|
30
|
-
const titleCase = words.map(word => capitalize(word.toLowerCase())).join(' ');
|
|
31
|
-
const result = {
|
|
32
|
-
original: str,
|
|
33
|
-
camelCase,
|
|
34
|
-
pascalCase,
|
|
35
|
-
kebabCase,
|
|
36
|
-
snakeCase,
|
|
37
|
-
constantCase,
|
|
38
|
-
dotCase,
|
|
39
|
-
pathCase,
|
|
40
|
-
sentenceCase,
|
|
41
|
-
titleCase,
|
|
42
|
-
detectedCase
|
|
43
|
-
};
|
|
44
|
-
if (returnDetails) {
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
switch (targetCase) {
|
|
48
|
-
case 'camel': return camelCase;
|
|
49
|
-
case 'pascal': return pascalCase;
|
|
50
|
-
case 'kebab': return kebabCase;
|
|
51
|
-
case 'snake': return snakeCase;
|
|
52
|
-
case 'constant': return constantCase;
|
|
53
|
-
case 'dot': return dotCase;
|
|
54
|
-
case 'path': return pathCase;
|
|
55
|
-
case 'sentence': return sentenceCase;
|
|
56
|
-
case 'title': return titleCase;
|
|
57
|
-
default:
|
|
58
|
-
throw new Error(`Invalid target case: ${targetCase}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function detectCase(str) {
|
|
62
|
-
if (/^[a-z]+([A-Z][a-z]*)*$/.test(str))
|
|
63
|
-
return 'camel';
|
|
64
|
-
if (/^[A-Z][a-z]*([A-Z][a-z]*)*$/.test(str))
|
|
65
|
-
return 'pascal';
|
|
66
|
-
if (/^[a-z]+(-[a-z]+)*$/.test(str))
|
|
67
|
-
return 'kebab';
|
|
68
|
-
if (/^[a-z]+(_[a-z]+)*$/.test(str))
|
|
69
|
-
return 'snake';
|
|
70
|
-
if (/^[A-Z]+(_[A-Z]+)*$/.test(str))
|
|
71
|
-
return 'constant';
|
|
72
|
-
if (/^[a-z]+(\.[a-z]+)*$/.test(str))
|
|
73
|
-
return 'dot';
|
|
74
|
-
if (/^[a-z]+(\/[a-z]+)*$/.test(str))
|
|
75
|
-
return 'path';
|
|
76
|
-
if (/^[A-Z][a-z]*( [a-z]+)*$/.test(str))
|
|
77
|
-
return 'sentence';
|
|
78
|
-
if (/^[A-Z][a-z]*( [A-Z][a-z]*)*$/.test(str))
|
|
79
|
-
return 'title';
|
|
80
|
-
return 'mixed';
|
|
81
|
-
}
|
|
82
|
-
function splitIntoWords(str, preserveConsecutiveUppercase) {
|
|
83
|
-
let result = str
|
|
84
|
-
.replace(/[-_.\/ ]+/g, '|')
|
|
85
|
-
.replace(/([a-z])([A-Z])/g, '$1|$2');
|
|
86
|
-
if (!preserveConsecutiveUppercase) {
|
|
87
|
-
result = result.replace(/([A-Z])([A-Z][a-z])/g, '$1|$2');
|
|
88
|
-
}
|
|
89
|
-
return result
|
|
90
|
-
.split('|')
|
|
91
|
-
.filter(word => word.length > 0)
|
|
92
|
-
.map(word => word.trim());
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=caseConverter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"caseConverter.js","sourceRoot":"","sources":["../../../src/functions/string/caseConverter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAoCzC,MAAM,UAAU,aAAa,CAC3B,GAAW,EACX,UAAuB,EAAE,EACzB,gBAAyB,KAAK;IAE9B,MAAM,EAAE,UAAU,GAAG,OAAO,EAAE,4BAA4B,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IAE9E,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,WAAW,GAAG;YAClB,QAAQ,EAAE,GAAG;YACb,SAAS,EAAE,GAAG;YACd,UAAU,EAAE,GAAG;YACf,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,GAAG;YACd,YAAY,EAAE,GAAG;YACjB,OAAO,EAAE,GAAG;YACZ,QAAQ,EAAE,GAAG;YACb,YAAY,EAAE,GAAG;YACjB,SAAS,EAAE,GAAG;YACd,YAAY,EAAE,OAAgB;SAC/B,CAAA;QACD,OAAO,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAA;IAC1C,CAAC;IAGD,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;IAGpC,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,EAAE,4BAA4B,CAAC,CAAA;IAG/D,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAC1C,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAClE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEV,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,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OAAO,KAAK,CAAA;IACjD,IAAI,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,MAAM,CAAA;IAClD,IAAI,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,UAAU,CAAA;IAC1D,IAAI,8BAA8B,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAA;IAC5D,OAAO,OAAO,CAAA;AAChB,CAAC;AAKD,SAAS,cAAc,CAAC,GAAW,EAAE,4BAAqC;IAExE,IAAI,MAAM,GAAG,GAAG;SAEb,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC;SAE1B,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IAEtC,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAElC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAA;IAC1D,CAAC;IAED,OAAO,MAAM;SACV,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SAC/B,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type DesensitizeType = 'name' | 'phone' | 'email' | 'idCard' | 'bankCard' | 'auto';
|
|
2
|
-
export interface DesensitizeOptions {
|
|
3
|
-
maskChar?: string;
|
|
4
|
-
keepStart?: number;
|
|
5
|
-
keepEnd?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function desensitize(data: string, type: DesensitizeType, options?: DesensitizeOptions): string;
|
|
8
|
-
export declare function autoDesensitize(data: string, options?: DesensitizeOptions): string;
|
|
9
|
-
export declare function desensitizeName(name: string, options?: DesensitizeOptions): string;
|
|
10
|
-
export declare function desensitizePhone(phone: string, options?: DesensitizeOptions): string;
|
|
11
|
-
export declare function desensitizeEmail(email: string, options?: DesensitizeOptions): string;
|
|
12
|
-
export declare function desensitizeIdCard(idCard: string, options?: DesensitizeOptions): string;
|
|
13
|
-
export declare function desensitizeBankCard(bankCard: string, options?: DesensitizeOptions): string;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
export function desensitize(data, type, options = {}) {
|
|
2
|
-
if (!data)
|
|
3
|
-
return '';
|
|
4
|
-
const { maskChar = '*' } = options;
|
|
5
|
-
switch (type) {
|
|
6
|
-
case 'name':
|
|
7
|
-
return desensitizeName(data, { maskChar, ...options });
|
|
8
|
-
case 'phone':
|
|
9
|
-
return desensitizePhone(data, { maskChar, ...options });
|
|
10
|
-
case 'email':
|
|
11
|
-
return desensitizeEmail(data, { maskChar, ...options });
|
|
12
|
-
case 'idCard':
|
|
13
|
-
return desensitizeIdCard(data, { maskChar, ...options });
|
|
14
|
-
case 'bankCard':
|
|
15
|
-
return desensitizeBankCard(data, { maskChar, ...options });
|
|
16
|
-
case 'auto':
|
|
17
|
-
return autoDesensitize(data, { maskChar, ...options });
|
|
18
|
-
default:
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export function autoDesensitize(data, options = {}) {
|
|
23
|
-
if (!data || typeof data !== 'string')
|
|
24
|
-
return data;
|
|
25
|
-
const { maskChar = '*' } = options;
|
|
26
|
-
if (data.length === 11 && /^1\d{10}$/.test(data)) {
|
|
27
|
-
return desensitizePhone(data, options);
|
|
28
|
-
}
|
|
29
|
-
if (data.includes('@')) {
|
|
30
|
-
return desensitizeEmail(data, options);
|
|
31
|
-
}
|
|
32
|
-
if (data.length === 18 && /^\d{17}[\dXx]$/.test(data)) {
|
|
33
|
-
return desensitizeIdCard(data, options);
|
|
34
|
-
}
|
|
35
|
-
if (data.length >= 16 && /^\d+$/.test(data)) {
|
|
36
|
-
return desensitizeBankCard(data, options);
|
|
37
|
-
}
|
|
38
|
-
if (data.length <= 4 && /^[\u4e00-\u9fa5a-zA-Z]+$/.test(data)) {
|
|
39
|
-
return desensitizeName(data, options);
|
|
40
|
-
}
|
|
41
|
-
const len = data.length;
|
|
42
|
-
if (len <= 2)
|
|
43
|
-
return data;
|
|
44
|
-
return data.charAt(0) + maskChar.repeat(len - 2) + data.charAt(len - 1);
|
|
45
|
-
}
|
|
46
|
-
export function desensitizeName(name, options = {}) {
|
|
47
|
-
if (!name)
|
|
48
|
-
return '';
|
|
49
|
-
if (name.length === 1)
|
|
50
|
-
return name;
|
|
51
|
-
const { maskChar = '*', keepStart = 0, keepEnd = 1 } = options;
|
|
52
|
-
const start = name.slice(0, keepStart);
|
|
53
|
-
const end = name.slice(-keepEnd);
|
|
54
|
-
const maskLength = Math.max(0, name.length - keepStart - keepEnd);
|
|
55
|
-
return start + maskChar.repeat(maskLength) + end;
|
|
56
|
-
}
|
|
57
|
-
export function desensitizePhone(phone, options = {}) {
|
|
58
|
-
if (!phone)
|
|
59
|
-
return '';
|
|
60
|
-
if (phone.length <= 7)
|
|
61
|
-
return phone;
|
|
62
|
-
const { maskChar = '*', keepStart = 3, keepEnd = 4 } = options;
|
|
63
|
-
const start = phone.slice(0, keepStart);
|
|
64
|
-
const end = phone.slice(-keepEnd);
|
|
65
|
-
const maskLength = Math.max(0, phone.length - keepStart - keepEnd);
|
|
66
|
-
return start + maskChar.repeat(maskLength) + end;
|
|
67
|
-
}
|
|
68
|
-
export function desensitizeEmail(email, options = {}) {
|
|
69
|
-
if (!email)
|
|
70
|
-
return '';
|
|
71
|
-
const atIndex = email.indexOf('@');
|
|
72
|
-
if (atIndex === -1)
|
|
73
|
-
return email;
|
|
74
|
-
const { maskChar = '*', keepStart = 1, keepEnd = 1 } = options;
|
|
75
|
-
const username = email.slice(0, atIndex);
|
|
76
|
-
const domain = email.slice(atIndex);
|
|
77
|
-
if (username.length <= keepStart + keepEnd) {
|
|
78
|
-
return email;
|
|
79
|
-
}
|
|
80
|
-
const start = username.slice(0, keepStart);
|
|
81
|
-
const end = username.slice(-keepEnd);
|
|
82
|
-
const maskLength = username.length - keepStart - keepEnd;
|
|
83
|
-
return start + maskChar.repeat(maskLength) + end + domain;
|
|
84
|
-
}
|
|
85
|
-
export function desensitizeIdCard(idCard, options = {}) {
|
|
86
|
-
if (!idCard)
|
|
87
|
-
return '';
|
|
88
|
-
if (idCard.length < 8)
|
|
89
|
-
return idCard;
|
|
90
|
-
const { maskChar = '*', keepStart = 4, keepEnd = 4 } = options;
|
|
91
|
-
const start = idCard.slice(0, keepStart);
|
|
92
|
-
const end = idCard.slice(-keepEnd);
|
|
93
|
-
const maskLength = Math.max(0, idCard.length - keepStart - keepEnd);
|
|
94
|
-
return start + maskChar.repeat(maskLength) + end;
|
|
95
|
-
}
|
|
96
|
-
export function desensitizeBankCard(bankCard, options = {}) {
|
|
97
|
-
if (!bankCard)
|
|
98
|
-
return '';
|
|
99
|
-
if (bankCard.length < 8)
|
|
100
|
-
return bankCard;
|
|
101
|
-
const { maskChar = '*', keepStart = 4, keepEnd = 4 } = options;
|
|
102
|
-
const start = bankCard.slice(0, keepStart);
|
|
103
|
-
const end = bankCard.slice(-keepEnd);
|
|
104
|
-
const maskLength = Math.max(0, bankCard.length - keepStart - keepEnd);
|
|
105
|
-
return start + maskChar.repeat(maskLength) + end;
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=desensitize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"desensitize.js","sourceRoot":"","sources":["../../../src/functions/string/desensitize.ts"],"names":[],"mappings":"AAmCA,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,IAAqB,EAAE,UAA8B,EAAE;IAC/F,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,MAAM,EAAE,QAAQ,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IAEnC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,OAAO,eAAe,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC,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SAAS,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;IAC/D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC3C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;IAEtE,OAAO,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC;AACnD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function escape(str: string): string;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function escape(str) {
|
|
2
|
-
if (!str)
|
|
3
|
-
return str;
|
|
4
|
-
const htmlEscapes = {
|
|
5
|
-
'&': '&',
|
|
6
|
-
'<': '<',
|
|
7
|
-
'>': '>',
|
|
8
|
-
'"': '"',
|
|
9
|
-
"'": '''
|
|
10
|
-
};
|
|
11
|
-
return str.replace(/[&<>"']/g, (match) => htmlEscapes[match]);
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=escape.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../../src/functions/string/escape.ts"],"names":[],"mappings":"AAqBA,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAA;IAEpB,MAAM,WAAW,GAA2B;QAC1C,GAAG,EAAE,OAAO;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,QAAQ;QACb,GAAG,EAAE,OAAO;KACb,CAAA;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type EscapeDirection = 'escape' | 'unescape' | 'both';
|
|
2
|
-
export interface EscapeOptions {
|
|
3
|
-
direction?: EscapeDirection;
|
|
4
|
-
}
|
|
5
|
-
export interface EscapeResult {
|
|
6
|
-
original: string;
|
|
7
|
-
escaped: string;
|
|
8
|
-
unescaped: string;
|
|
9
|
-
direction: EscapeDirection;
|
|
10
|
-
hasHtmlChars: boolean;
|
|
11
|
-
hasHtmlEntities: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare function escapeHtml(str: string): string;
|
|
14
|
-
export declare function unescapeHtml(str: string): string;
|
|
15
|
-
export declare function htmlEscape(str: string, options?: EscapeOptions, returnDetails?: boolean): string | EscapeResult;
|
|
16
|
-
export declare function needsEscape(str: string): boolean;
|
|
17
|
-
export declare function hasEntities(str: string): boolean;
|
|
18
|
-
export declare function smartEscape(str: string): string;
|
|
19
|
-
export declare function escape(str: string): string;
|
|
20
|
-
export declare function unescape(str: string): string;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const HTML_ESCAPES = {
|
|
2
|
-
'&': '&',
|
|
3
|
-
'<': '<',
|
|
4
|
-
'>': '>',
|
|
5
|
-
'"': '"',
|
|
6
|
-
"'": '''
|
|
7
|
-
};
|
|
8
|
-
const HTML_UNESCAPES = {
|
|
9
|
-
'&': '&',
|
|
10
|
-
'<': '<',
|
|
11
|
-
'>': '>',
|
|
12
|
-
'"': '"',
|
|
13
|
-
''': "'"
|
|
14
|
-
};
|
|
15
|
-
const HTML_CHARS_REGEX = /[&<>"']/g;
|
|
16
|
-
const HTML_ENTITIES_REGEX = /&(?:amp|lt|gt|quot|#39);/g;
|
|
17
|
-
const HTML_CHARS_TEST_REGEX = /[&<>"']/;
|
|
18
|
-
const HTML_ENTITIES_TEST_REGEX = /&(?:amp|lt|gt|quot|#39);/;
|
|
19
|
-
export function escapeHtml(str) {
|
|
20
|
-
return str.replace(HTML_CHARS_REGEX, (match) => HTML_ESCAPES[match]);
|
|
21
|
-
}
|
|
22
|
-
export function unescapeHtml(str) {
|
|
23
|
-
return str.replace(HTML_ENTITIES_REGEX, (match) => HTML_UNESCAPES[match]);
|
|
24
|
-
}
|
|
25
|
-
export function htmlEscape(str, options = {}, returnDetails = false) {
|
|
26
|
-
const { direction = 'escape' } = options;
|
|
27
|
-
if (!str) {
|
|
28
|
-
if (returnDetails) {
|
|
29
|
-
return {
|
|
30
|
-
original: str,
|
|
31
|
-
escaped: str,
|
|
32
|
-
unescaped: str,
|
|
33
|
-
direction,
|
|
34
|
-
hasHtmlChars: false,
|
|
35
|
-
hasHtmlEntities: false
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return str;
|
|
39
|
-
}
|
|
40
|
-
const escaped = escapeHtml(str);
|
|
41
|
-
const unescaped = unescapeHtml(str);
|
|
42
|
-
const hasHtmlChars = HTML_CHARS_TEST_REGEX.test(str);
|
|
43
|
-
const hasHtmlEntities = HTML_ENTITIES_TEST_REGEX.test(str);
|
|
44
|
-
if (returnDetails) {
|
|
45
|
-
return {
|
|
46
|
-
original: str,
|
|
47
|
-
escaped,
|
|
48
|
-
unescaped,
|
|
49
|
-
direction,
|
|
50
|
-
hasHtmlChars,
|
|
51
|
-
hasHtmlEntities
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
switch (direction) {
|
|
55
|
-
case 'escape':
|
|
56
|
-
return escaped;
|
|
57
|
-
case 'unescape':
|
|
58
|
-
return unescaped;
|
|
59
|
-
case 'both':
|
|
60
|
-
return hasHtmlEntities ? unescaped : escaped;
|
|
61
|
-
default:
|
|
62
|
-
throw new Error(`Invalid escape direction: ${direction}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export function needsEscape(str) {
|
|
66
|
-
return HTML_CHARS_TEST_REGEX.test(str);
|
|
67
|
-
}
|
|
68
|
-
export function hasEntities(str) {
|
|
69
|
-
return HTML_ENTITIES_TEST_REGEX.test(str);
|
|
70
|
-
}
|
|
71
|
-
export function smartEscape(str) {
|
|
72
|
-
return hasEntities(str) ? unescapeHtml(str) : escapeHtml(str);
|
|
73
|
-
}
|
|
74
|
-
export function escape(str) {
|
|
75
|
-
return escapeHtml(str);
|
|
76
|
-
}
|
|
77
|
-
export function unescape(str) {
|
|
78
|
-
return unescapeHtml(str);
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=htmlEscape.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"htmlEscape.js","sourceRoot":"","sources":["../../../src/functions/string/htmlEscape.ts"],"names":[],"mappings":"AAgBA,MAAM,YAAY,GAA2B;IAC3C,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,OAAO;CACb,CAAA;AAGD,MAAM,cAAc,GAA2B;IAC7C,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,GAAG;CACb,CAAA;AAGD,MAAM,gBAAgB,GAAG,UAAU,CAAA;AACnC,MAAM,mBAAmB,GAAG,2BAA2B,CAAA;AACvD,MAAM,qBAAqB,GAAG,SAAS,CAAA;AACvC,MAAM,wBAAwB,GAAG,0BAA0B,CAAA;AAkB3D,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;AACtE,CAAC;AAKD,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAA;AAC3E,CAAC;AAED,MAAM,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AAO,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC3C,CAAC;AAGD,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAC/D,CAAC;AAGD,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,OAAO,UAAU,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function kebabCase(str: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kebabCase.js","sourceRoot":"","sources":["../../../src/functions/string/kebabCase.ts"],"names":[],"mappings":"AAoBA,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAA;IAEpB,OAAO,GAAG;SACP,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;SACzB,WAAW,EAAE;SACb,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AAC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function levenshtein(str1: string, str2: string): number;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export function levenshtein(str1, str2) {
|
|
2
|
-
if (str1 === str2)
|
|
3
|
-
return 0;
|
|
4
|
-
if (str1.length === 0)
|
|
5
|
-
return str2.length;
|
|
6
|
-
if (str2.length === 0)
|
|
7
|
-
return str1.length;
|
|
8
|
-
const matrix = [];
|
|
9
|
-
for (let i = 0; i <= str2.length; i++) {
|
|
10
|
-
matrix[i] = [i];
|
|
11
|
-
}
|
|
12
|
-
for (let j = 0; j <= str1.length; j++) {
|
|
13
|
-
matrix[0][j] = j;
|
|
14
|
-
}
|
|
15
|
-
for (let i = 1; i <= str2.length; i++) {
|
|
16
|
-
for (let j = 1; j <= str1.length; j++) {
|
|
17
|
-
if (str2.charAt(i - 1) === str1.charAt(j - 1)) {
|
|
18
|
-
matrix[i][j] = matrix[i - 1][j - 1];
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j] + 1);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return matrix[str2.length][str1.length];
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=levenshtein.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"levenshtein.js","sourceRoot":"","sources":["../../../src/functions/string/levenshtein.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,IAAY;IACpD,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,CAAC,CAAA;IAC3B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,MAAM,CAAA;IACzC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,MAAM,CAAA;IAEzC,MAAM,MAAM,GAAe,EAAE,CAAA;IAG7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAClB,CAAC;IAGD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC9C,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YACrC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CACrB,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EACxB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EACpB,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CACrB,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACzC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function mask(str: string, type?: 'phone' | 'email' | 'card' | 'idcard' | 'name' | 'auto', maskChar?: string): string;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export function mask(str, type = 'auto', maskChar = '*') {
|
|
2
|
-
if (!str || typeof str !== 'string')
|
|
3
|
-
return str;
|
|
4
|
-
switch (type) {
|
|
5
|
-
case 'phone':
|
|
6
|
-
return str.replace(/^(\d{3})\d{4}(\d{4})$/, `$1${maskChar.repeat(4)}$2`);
|
|
7
|
-
case 'email':
|
|
8
|
-
return str.replace(/^(\w)\w*(@.+)$/, `$1${maskChar.repeat(3)}$2`);
|
|
9
|
-
case 'card':
|
|
10
|
-
return str.replace(/^(\d{4})\d+(\d{4})$/, `$1${maskChar.repeat(4)}$2`);
|
|
11
|
-
case 'idcard':
|
|
12
|
-
return str.replace(/^(\d{6})\d+(\d{4})$/, `$1${maskChar.repeat(4)}$2`);
|
|
13
|
-
case 'name':
|
|
14
|
-
return str.replace(/^(\w)\w*$/, `$1${maskChar}`);
|
|
15
|
-
case 'auto':
|
|
16
|
-
default:
|
|
17
|
-
if (str.length === 11 && /^1\d{10}$/.test(str)) {
|
|
18
|
-
return mask(str, 'phone', maskChar);
|
|
19
|
-
}
|
|
20
|
-
else if (str.includes('@')) {
|
|
21
|
-
return mask(str, 'email', maskChar);
|
|
22
|
-
}
|
|
23
|
-
else if (str.length >= 16 && /^\d+$/.test(str)) {
|
|
24
|
-
return mask(str, 'card', maskChar);
|
|
25
|
-
}
|
|
26
|
-
else if (str.length === 18 && /^\d{17}[\dXx]$/.test(str)) {
|
|
27
|
-
return mask(str, 'idcard', maskChar);
|
|
28
|
-
}
|
|
29
|
-
else if (str.length <= 4 && /^[\u4e00-\u9fa5a-zA-Z]+$/.test(str)) {
|
|
30
|
-
return mask(str, 'name', maskChar);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const len = str.length;
|
|
34
|
-
if (len <= 2)
|
|
35
|
-
return str;
|
|
36
|
-
return str.charAt(0) + maskChar.repeat(len - 2) + str.charAt(len - 1);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=mask.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mask.js","sourceRoot":"","sources":["../../../src/functions/string/mask.ts"],"names":[],"mappings":"AAqBA,MAAM,UAAU,IAAI,CAClB,GAAW,EACX,OAAgE,MAAM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EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;YACpC,CAAC;iBAAM,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3D,OAAO,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;YACtC,CAAC;iBAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,0BAA0B,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnE,OAAO,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;YACpC,CAAC;iBAAM,CAAC;gBAEN,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;gBACtB,IAAI,GAAG,IAAI,CAAC;oBAAE,OAAO,GAAG,CAAA;gBACxB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;YACvE,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export function normalize(str, options = {}) {
|
|
2
|
-
if (!str || typeof str !== 'string')
|
|
3
|
-
return str;
|
|
4
|
-
const { case: caseOption = 'none', trim = true, removeSpecial = false, removeNumbers = false, removePunctuation = false, normalizeWhitespace = true } = options;
|
|
5
|
-
let result = str;
|
|
6
|
-
if (removeSpecial) {
|
|
7
|
-
result = result.replace(/[^\w\s]/g, '');
|
|
8
|
-
}
|
|
9
|
-
if (removeNumbers) {
|
|
10
|
-
result = result.replace(/\d/g, '');
|
|
11
|
-
}
|
|
12
|
-
if (removePunctuation) {
|
|
13
|
-
result = result.replace(/[^\w\s]/g, '');
|
|
14
|
-
}
|
|
15
|
-
if (normalizeWhitespace) {
|
|
16
|
-
result = result.replace(/\s+/g, ' ');
|
|
17
|
-
}
|
|
18
|
-
if (trim) {
|
|
19
|
-
result = result.trim();
|
|
20
|
-
}
|
|
21
|
-
switch (caseOption) {
|
|
22
|
-
case 'lower':
|
|
23
|
-
result = result.toLowerCase();
|
|
24
|
-
break;
|
|
25
|
-
case 'upper':
|
|
26
|
-
result = result.toUpperCase();
|
|
27
|
-
break;
|
|
28
|
-
case 'title':
|
|
29
|
-
result = result.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase());
|
|
30
|
-
break;
|
|
31
|
-
case 'none':
|
|
32
|
-
default:
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=normalize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/functions/string/normalize.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,SAAS,CACvB,GAAW,EACX,UAOI,EAAE;IAEN,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAA;IAE/C,MAAM,EACJ,IAAI,EAAE,UAAU,GAAG,MAAM,EACzB,IAAI,GAAG,IAAI,EACX,aAAa,GAAG,KAAK,EACrB,aAAa,GAAG,KAAK,EACrB,iBAAiB,GAAG,KAAK,EACzB,mBAAmB,GAAG,IAAI,EAC3B,GAAG,OAAO,CAAA;IAEX,IAAI,MAAM,GAAG,GAAG,CAAA;IAGhB,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IACzC,CAAC;IAGD,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACpC,CAAC;IAGD,IAAI,iBAAiB,EAAE,CAAC;QACtB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IACzC,CAAC;IAGD,IAAI,mBAAmB,EAAE,CAAC;QACxB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACtC,CAAC;IAGD,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;IACxB,CAAC;IAGD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,OAAO;YACV,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;YAC7B,MAAK;QACP,KAAK,OAAO;YACV,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;YAC7B,MAAK;QACP,KAAK,OAAO;YACV,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;YAC5E,MAAK;QACP,KAAK,MAAM,CAAC;QACZ;YACE,MAAK;IACT,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type PadDirection = 'start' | 'end' | 'both';
|
|
2
|
-
export interface PadOptions {
|
|
3
|
-
direction?: PadDirection;
|
|
4
|
-
padString?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface PadResult {
|
|
7
|
-
original: string;
|
|
8
|
-
padded: string;
|
|
9
|
-
paddedLength: number;
|
|
10
|
-
padDirection: PadDirection;
|
|
11
|
-
padCharacter: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function pad(str: string, targetLength: number, options?: PadOptions, returnDetails?: boolean): string | PadResult;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export function pad(str, targetLength, options = {}, returnDetails = false) {
|
|
2
|
-
const { direction = 'end', padString = ' ' } = options;
|
|
3
|
-
if (str.length >= targetLength) {
|
|
4
|
-
if (returnDetails) {
|
|
5
|
-
return {
|
|
6
|
-
original: str,
|
|
7
|
-
padded: str,
|
|
8
|
-
paddedLength: str.length,
|
|
9
|
-
padDirection: direction,
|
|
10
|
-
padCharacter: padString
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
return str;
|
|
14
|
-
}
|
|
15
|
-
const padLength = targetLength - str.length;
|
|
16
|
-
let padded;
|
|
17
|
-
switch (direction) {
|
|
18
|
-
case 'start': {
|
|
19
|
-
const pad = padString.repeat(Math.ceil(padLength / padString.length)).slice(0, padLength);
|
|
20
|
-
padded = pad + str;
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
case 'end': {
|
|
24
|
-
const pad = padString.repeat(Math.ceil(padLength / padString.length)).slice(0, padLength);
|
|
25
|
-
padded = str + pad;
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
case 'both': {
|
|
29
|
-
const leftPadLength = Math.floor(padLength / 2);
|
|
30
|
-
const rightPadLength = padLength - leftPadLength;
|
|
31
|
-
const leftPad = padString.repeat(Math.ceil(leftPadLength / padString.length)).slice(0, leftPadLength);
|
|
32
|
-
const rightPad = padString.repeat(Math.ceil(rightPadLength / padString.length)).slice(0, rightPadLength);
|
|
33
|
-
padded = leftPad + str + rightPad;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
default:
|
|
37
|
-
throw new Error(`Invalid pad direction: ${direction}`);
|
|
38
|
-
}
|
|
39
|
-
if (returnDetails) {
|
|
40
|
-
return {
|
|
41
|
-
original: str,
|
|
42
|
-
padded,
|
|
43
|
-
paddedLength: padded.length,
|
|
44
|
-
padDirection: direction,
|
|
45
|
-
padCharacter: padString
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return padded;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=pad.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pad.js","sourceRoot":"","sources":["../../../src/functions/string/pad.ts"],"names":[],"mappings":"AA4BA,MAAM,UAAU,GAAG,CACjB,GAAW,EACX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D,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAA;YACrG,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAA;YAExG,MAAM,GAAG,OAAO,GAAG,GAAG,GAAG,QAAQ,CAAA;YACjC,MAAK;QACP,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,SAAS,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO;YACL,QAAQ,EAAE,GAAG;YACb,MAAM;YACN,YAAY,EAAE,MAAM,CAAC,MAAM;YAC3B,YAAY,EAAE,SAAS;YACvB,YAAY,EAAE,SAAS;SACxB,CAAA;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function padEnd(str: string, targetLength: number, padString?: string): string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export function padEnd(str, targetLength, padString = ' ') {
|
|
2
|
-
if (str.length >= targetLength)
|
|
3
|
-
return str;
|
|
4
|
-
const padLength = targetLength - str.length;
|
|
5
|
-
const pad = padString.repeat(Math.ceil(padLength / padString.length)).slice(0, padLength);
|
|
6
|
-
return str + pad;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=padEnd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"padEnd.js","sourceRoot":"","sources":["../../../src/functions/string/padEnd.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,MAAM,CAAC,GAAW,EAAE,YAAoB,EAAE,YAAoB,GAAG;IAC/E,IAAI,GAAG,CAAC,MAAM,IAAI,YAAY;QAAE,OAAO,GAAG,CAAA;IAE1C,MAAM,SAAS,GAAG,YAAY,GAAG,GAAG,CAAC,MAAM,CAAA;IAC3C,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;IAEzF,OAAO,GAAG,GAAG,GAAG,CAAA;AAClB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function padStart(str: string, targetLength: number, padString?: string): string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export function padStart(str, targetLength, padString = ' ') {
|
|
2
|
-
if (str.length >= targetLength)
|
|
3
|
-
return str;
|
|
4
|
-
const padLength = targetLength - str.length;
|
|
5
|
-
const pad = padString.repeat(Math.ceil(padLength / padString.length)).slice(0, padLength);
|
|
6
|
-
return pad + str;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=padStart.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"padStart.js","sourceRoot":"","sources":["../../../src/functions/string/padStart.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,YAAoB,EAAE,YAAoB,GAAG;IACjF,IAAI,GAAG,CAAC,MAAM,IAAI,YAAY;QAAE,OAAO,GAAG,CAAA;IAE1C,MAAM,SAAS,GAAG,YAAY,GAAG,GAAG,CAAC,MAAM,CAAA;IAC3C,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;IAEzF,OAAO,GAAG,GAAG,GAAG,CAAA;AAClB,CAAC"}
|