feat: Introduce fe modular build system

This commit is contained in:
divocat
2025-10-02 21:40:16 +03:00
parent 4ef15f7340
commit 294cb21e91
21 changed files with 2294 additions and 17 deletions

View File

@@ -0,0 +1,20 @@
import { ValidationResult } from './types.js';
export function validateUrl(
url: string,
protocols: string[] = ['http:', 'https:'],
): ValidationResult {
try {
const parsedUrl = new URL(url);
if (!protocols.includes(parsedUrl.protocol)) {
return {
valid: false,
message: `URL must use one of the following protocols: ${protocols.join(', ')}`,
};
}
return { valid: true, message: 'Valid' };
} catch (e) {
return { valid: false, message: 'Invalid URL format' };
}
}