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

Function make

packages/effect/src/unstable/http/Url.ts:38–58  ·  view source on GitHub ↗
(
  url: string,
  params: UrlParams.UrlParams,
  hash: string | undefined
)

Source from the content-addressed store, hash-verified

36 * @since 4.0.0
37 */
38export const make = (
39 url: string,
40 params: UrlParams.UrlParams,
41 hash: string | undefined
42): Result.Result<URL, UrlError> =>
43 Result.try({
44 try: () => {
45 const urlInstance = new URL(url, baseUrl())
46 for (let i = 0; i < params.params.length; i++) {
47 const [key, value] = params.params[i]
48 if (value !== undefined) {
49 urlInstance.searchParams.append(key, value)
50 }
51 }
52 if (hash !== undefined) {
53 urlInstance.hash = hash
54 }
55 return urlInstance
56 },
57 catch: (cause) => new UrlError({ cause })
58 })
59
60const baseUrl = (): string | undefined => {
61 if (

Callers 2

layerFunction · 0.70
HttpPlatform.tsFile · 0.70

Calls 1

baseUrlFunction · 0.85

Tested by

no test coverage detected