Skip to content

Commit

Permalink
Added URL.canParse
Browse files Browse the repository at this point in the history
  • Loading branch information
KamyaPA committed Dec 14, 2023
1 parent 09fa393 commit 85e0647
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/lib/classes/engine/Validation.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
const regexTest: RegExp = new RegExp(
"^(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]?)$", // Will test for any valid IP address
);

export function validateName(name: string | undefined): boolean {
if (name != "" && name !== undefined) return true;
return false;
}

export function validateIP(ipAdress: string): boolean {
return regexTest.test(ipAdress);
return URL.canParse(ipAdress);
}

export function validateStartPort(port: number): boolean {
Expand Down

0 comments on commit 85e0647

Please sign in to comment.