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

Function formatUrl

packages/effect/src/net/NetAddress.ts:2177–2183  ·  view source on GitHub ↗
(
  self: IpAddress | SocketAddress,
  scheme: string = "http"
)

Source from the content-addressed store, hash-verified

2175 * @since 4.0.0
2176 */
2177export const formatUrl = (
2178 self: IpAddress | SocketAddress,
2179 scheme: string = "http"
2180): Result.Result<string, NetAddressError> =>
2181 isUnixPathAddress(self)
2182 ? Result.succeed(formatUnixPath(self))
2183 : Result.map(toUrl(self, scheme), (url) => `${url.protocol}//${url.host}`)
2184
2185/**
2186 * Formats an IP or socket address as a URL display string,

Callers 1

formatUrlUnsafeFunction · 0.85

Calls 5

isUnixPathAddressFunction · 0.85
formatUnixPathFunction · 0.85
toUrlFunction · 0.70
succeedMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected