(input: MacAddressInput)
| 947 | * @since 4.0.0 |
| 948 | */ |
| 949 | export const macAddressFromInput = (input: MacAddressInput): Result.Result<MacAddress, NetAddressError> => { |
| 950 | if (isMacAddress(input)) return Result.succeed(input) |
| 951 | if (typeof input === "string") return macAddressFromString(input) |
| 952 | if (Array.isArray(input) && isTupleOf(input, 6)) return macAddressFromOctets(input) |
| 953 | return addressError(input, "expected a MAC address, string, or 6 octets") |
| 954 | } |
| 955 | |
| 956 | /** |
| 957 | * Converts a trusted `MacAddressInput` to a MAC address, throwing on failure. |
no test coverage detected