feat: migrate validatePath to modular

This commit is contained in:
divocat
2025-10-02 22:37:36 +03:00
parent 5e95148492
commit f58472a53d
7 changed files with 183 additions and 74 deletions

View File

@@ -0,0 +1,25 @@
import { ValidationResult } from './types';
export function validatePath(value: string): ValidationResult {
if (!value) {
return {
valid: false,
message: 'Path cannot be empty',
};
}
const pathRegex = /^\/[a-zA-Z0-9_\-/.]+$/;
if (pathRegex.test(value)) {
return {
valid: true,
message: 'Valid',
};
}
return {
valid: false,
message:
'Invalid path format. Path must start with "/" and contain valid characters',
};
}