mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-22 16:01:33 +03:00
9 lines
303 B
TypeScript
9 lines
303 B
TypeScript
export function isValidIPAddress(address: string) {
|
|
if (address === 'localhost') {
|
|
return true;
|
|
}
|
|
return /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(
|
|
address
|
|
);
|
|
}
|