MCPcopy Create free account
hub / github.com/Effect-TS/effect / socketAddressFromInput

Function socketAddressFromInput

packages/effect/src/net/NetAddress.ts:2266–2276  ·  view source on GitHub ↗
(
  input: SocketAddress.Input
)

Source from the content-addressed store, hash-verified

2264 * @since 4.0.0
2265 */
2266export 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,

Callers 1

Calls 6

hasPropertyFunction · 0.90
isUnixPathAddressFunction · 0.85
unixPathAddressFunction · 0.85
addressErrorFunction · 0.85
inetAddressFromInputFunction · 0.85
succeedMethod · 0.45

Tested by

no test coverage detected