(input: Ipv4AddressInput)
| 1141 | * @since 4.0.0 |
| 1142 | */ |
| 1143 | export const ipv4FromInput = (input: Ipv4AddressInput): Result.Result<Ipv4Address, NetAddressError> => { |
| 1144 | if (isIpv4Address(input)) return Result.succeed(input) |
| 1145 | if (typeof input === "string") return ipv4FromString(input) |
| 1146 | if (input instanceof Uint8Array && input.length === 4) return Result.succeed(ipv4FromBytesUnsafe(input)) |
| 1147 | if (Array.isArray(input) && isTupleOf(input, 4)) return ipv4FromOctets(input) |
| 1148 | return addressError(input, "expected an IPv4 address, string, 4 octets, or 4 bytes") |
| 1149 | } |
| 1150 | |
| 1151 | /** |
| 1152 | * Converts an `Ipv6AddressInput` to an IPv6 address, parsing strings like |
nothing calls this directly
no test coverage detected