MCPcopy Index your code
hub / github.com/Effect-TS/effect / makeUrl

Function makeUrl

packages/platform/src/UrlParams.ts:208–224  ·  view source on GitHub ↗
(url: string, params: UrlParams, hash: Option.Option<string>)

Source from the content-addressed store, hash-verified

206 * @category conversions
207 */
208export const makeUrl = (url: string, params: UrlParams, hash: Option.Option<string>): Either.Either<URL, Error> => {
209 try {
210 const urlInstance = new URL(url, baseUrl())
211 for (let i = 0; i < params.length; i++) {
212 const [key, value] = params[i]
213 if (value !== undefined) {
214 urlInstance.searchParams.append(key, value)
215 }
216 }
217 if (hash._tag === "Some") {
218 urlInstance.hash = hash.value
219 }
220 return Either.right(urlInstance)
221 } catch (e) {
222 return Either.left(e as Error)
223 }
224}
225
226/**
227 * @since 1.0.0

Callers 1

onEndpointFunction · 0.85

Calls 1

baseUrlFunction · 0.85

Tested by

no test coverage detected