( input: SocketAddress.Input )
| 2264 | * @since 4.0.0 |
| 2265 | */ |
| 2266 | export const socketAddressFromInput = ( |
| 2267 | input: SocketAddress.Input |
| 2268 | ): Result.Result<SocketAddress, NetAddressError> => { |
| 2269 | if (isUnixPathAddress(input)) return Result.succeed(input) |
| 2270 | if (hasProperty(input, "path")) { |
| 2271 | return typeof input.path === "string" |
| 2272 | ? Result.succeed(unixPathAddress(input.path)) |
| 2273 | : addressError(input, "path must be a string") |
| 2274 | } |
| 2275 | return inetAddressFromInput(input) |
| 2276 | } |
| 2277 | |
| 2278 | /** |
| 2279 | * Converts a trusted `SocketAddress.Input` to a concrete socket address, |
no test coverage detected