Skip to content

Commit

Permalink
fix: 🐞 allow digits in patterns
Browse files Browse the repository at this point in the history
allow digits in patterns
  • Loading branch information
tal authored and tal committed Nov 8, 2023
1 parent e04fd09 commit 0297747
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/modules/app/validators/alias-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
* @param input the input to validate
* @returns a boolean flag indicates whether the input is valid
*/
export const validateSnakeAndKebebAndPointCase = (
export const validateSnakeAndKebabAndPointCase = (
input: string,
separator: string,
isScreaming: boolean,
Expand Down Expand Up @@ -46,6 +46,7 @@ export const validateSnakeAndKebebAndPointCase = (
const nextChar = inputArray[index + 1]!;

const isValidAlphabeticNextChar =
validateNumericChar(nextChar) ||
(!isScreaming && validateLowerCaseChar(nextChar)) ||
(isScreaming && validateUpperCaseChar(nextChar));

Expand Down
16 changes: 8 additions & 8 deletions src/modules/app/validators/alias.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
validateCamelCaseBase,
validatePascalCaseBase,
validateSnakeAndKebebAndPointCase,
validateSnakeAndKebabAndPointCase,
} from './alias-base';

/**
Expand Down Expand Up @@ -53,7 +53,7 @@ export const validatePascalCasePoint = (input: string) => {
* @returns a boolean flag indicates whether the input is valid
*/
export const validateSnakeCase = (input: string) => {
return validateSnakeAndKebebAndPointCase(input, '_', false, false);
return validateSnakeAndKebabAndPointCase(input, '_', false, false);
};

/**
Expand All @@ -62,7 +62,7 @@ export const validateSnakeCase = (input: string) => {
* @returns a boolean flag indicates whether the input is valid
*/
export const validateSnakeCasePoint = (input: string) => {
return validateSnakeAndKebebAndPointCase(input, '_', false, true);
return validateSnakeAndKebabAndPointCase(input, '_', false, true);
};

/**
Expand All @@ -71,7 +71,7 @@ export const validateSnakeCasePoint = (input: string) => {
* @returns a boolean flag indicates whether the input is valid
*/
export const validateScreamingSnakeCase = (input: string) => {
return validateSnakeAndKebebAndPointCase(input, '_', true, false);
return validateSnakeAndKebabAndPointCase(input, '_', true, false);
};

/**
Expand All @@ -80,7 +80,7 @@ export const validateScreamingSnakeCase = (input: string) => {
* @returns a boolean flag indicates whether the input is valid
*/
export const validateScreamingSnakeCasePoint = (input: string) => {
return validateSnakeAndKebebAndPointCase(input, '_', true, true);
return validateSnakeAndKebabAndPointCase(input, '_', true, true);
};

/**
Expand All @@ -89,7 +89,7 @@ export const validateScreamingSnakeCasePoint = (input: string) => {
* @returns a boolean flag indicates whether the input is valid
*/
export const validateKebabCase = (input: string) => {
return validateSnakeAndKebebAndPointCase(input, '-', false, false);
return validateSnakeAndKebabAndPointCase(input, '-', false, false);
};

/**
Expand All @@ -98,7 +98,7 @@ export const validateKebabCase = (input: string) => {
* @returns a boolean flag indicates whether the input is valid
*/
export const validateKebabCasePoint = (input: string) => {
return validateSnakeAndKebebAndPointCase(input, '-', false, true);
return validateSnakeAndKebabAndPointCase(input, '-', false, true);
};

/**
Expand All @@ -107,5 +107,5 @@ export const validateKebabCasePoint = (input: string) => {
* @returns a boolean flag indicates whether the input is valid
*/
export const validatePointCase = (input: string) => {
return validateSnakeAndKebebAndPointCase(input, '.', false, false);
return validateSnakeAndKebabAndPointCase(input, '.', false, false);
};

0 comments on commit 0297747

Please sign in to comment.