(ip: string)
| 41 | return Number.isInteger(n) && n >= 0 && n <= 255; |
| 42 | }); |
| 43 | } |
| 44 | |
| 45 | function networkAddress(ip: string, mask: number): string | null { |
| 46 | if (!isValidIPv4(ip)) return null; |
| 47 | |
| 48 | const parts = ip.split(".").map((p) => Number(p)); |
| 49 | const ipNum = |
| 50 | (((parts[0] << 24) | |
| 51 | (parts[1] << 16) | |
| 52 | (parts[2] << 8) | |
| 53 | parts[3]) >>> 0); |
no outgoing calls
no test coverage detected