Skip to content

Commit 4fef7f3

Browse files
Copilot0x5t4l1n
andauthored
Replace IP length magic number with named constant in both pages
Agent-Logs-Url: https://github.com/th30d4y/IP/sessions/6013f9b8-efa5-4d7e-a703-44d539e8bb47 Co-authored-by: Stalin-143 <161853795+Stalin-143@users.noreply.github.com>
1 parent 10dc05e commit 4fef7f3

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

both.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ <h1>IP Reputation Checker - Both Services</h1>
5151
container.appendChild(p);
5252
}
5353

54+
const MAX_IP_LENGTH = 45;
55+
5456
async function checkBoth() {
5557
const ip = document.getElementById("ipInput").value.trim();
5658
const resultDiv = document.getElementById("result");
@@ -60,7 +62,7 @@ <h1>IP Reputation Checker - Both Services</h1>
6062
return;
6163
}
6264

63-
if (ip.length > 45) {
65+
if (ip.length > MAX_IP_LENGTH) {
6466
resultDiv.textContent = "IP address is too long.";
6567
return;
6668
}

public/both.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ <h1>IP Reputation Checker - Both Services</h1>
5151
container.appendChild(p);
5252
}
5353

54+
const MAX_IP_LENGTH = 45;
55+
5456
async function checkBoth() {
5557
const ip = document.getElementById("ipInput").value.trim();
5658
const resultDiv = document.getElementById("result");
@@ -60,7 +62,7 @@ <h1>IP Reputation Checker - Both Services</h1>
6062
return;
6163
}
6264

63-
if (ip.length > 45) {
65+
if (ip.length > MAX_IP_LENGTH) {
6466
resultDiv.textContent = "IP address is too long.";
6567
return;
6668
}

0 commit comments

Comments
 (0)