mirror of
https://github.com/itdoginfo/podkop.git
synced 2026-07-21 06:43:28 +03:00
feat: Introduce fe modular build system
This commit is contained in:
12
fe-app-podkop/src/validators/validateIp.ts
Normal file
12
fe-app-podkop/src/validators/validateIp.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ValidationResult } from './types.js';
|
||||
|
||||
export function validateIPV4(ip: string): ValidationResult {
|
||||
const ipRegex =
|
||||
/^(?:(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/;
|
||||
|
||||
if (ipRegex.test(ip)) {
|
||||
return { valid: true, message: 'Valid' };
|
||||
}
|
||||
|
||||
return { valid: false, message: 'Invalid IP address' };
|
||||
}
|
||||
Reference in New Issue
Block a user