build fixes

This commit is contained in:
Aiden McClelland
2025-11-06 10:46:14 -07:00
parent acdade473c
commit 515d37147b
26 changed files with 275 additions and 187 deletions

View File

@@ -40,9 +40,15 @@ export const ipInSubnetValidator = (subnet: string | null = null) => {
return { invalidIp: 'Not a valid IP Address' }
}
if (!ipnet) return null
return ipnet.zero().cmp(ip) === -1 && ipnet.broadcast().cmp(ip) === 1
const zero = ipnet.zero().cmp(ip)
const broadcast = ipnet.broadcast().cmp(ip)
return zero + broadcast === 0
? null
: { notInSubnet: `Address is not part of ${subnet}` }
: zero === 0
? { isZeroAddr: `Address cannot be the zero address` }
: broadcast === 0
? { isBroadcastAddress: `Address cannot be the broadcast address` }
: { notInSubnet: `Address is not part of ${subnet}` }
}
}