barsa 1b944f57aa Update Configuration Files and Refactor Code Structure
- Adjusted .prettierrc to ensure consistent formatting with a newline at the end of the file.
- Reformatted eslint.config.mjs for improved readability by aligning array elements.
- Updated pnpm-lock.yaml to use single quotes for consistency across dependencies.
- Simplified worktree setup in .cursor/worktrees.json for cleaner configuration.
- Enhanced documentation in .cursor/plans to clarify architecture refactoring.
- Refactored various service files for improved readability and maintainability, including rate-limiting and auth services.
- Updated imports and exports across multiple files for consistency and clarity.
- Improved error handling and logging in service methods to enhance debugging capabilities.
- Streamlined utility functions for better performance and maintainability across the domain packages.
2025-12-25 17:30:02 +09:00

48 lines
984 B
TypeScript

/**
* Toolkit - String Validation
*
* String validation utilities.
*/
/**
* Check if string is empty or only whitespace
*/
export function isEmpty(str: string | null | undefined): boolean {
return !str || str.trim().length === 0;
}
/**
* Check if string has minimum length
*/
export function hasMinLength(str: string, minLength: number): boolean {
return str.trim().length >= minLength;
}
/**
* Check if string has maximum length
*/
export function hasMaxLength(str: string, maxLength: number): boolean {
return str.trim().length <= maxLength;
}
/**
* Check if string contains only alphanumeric characters
*/
export function isAlphanumeric(str: string): boolean {
return /^[a-z0-9]+$/i.test(str);
}
/**
* Check if string contains only letters
*/
export function isAlpha(str: string): boolean {
return /^[a-z]+$/i.test(str);
}
/**
* Check if string contains only digits
*/
export function isNumeric(str: string): boolean {
return /^\d+$/.test(str);
}