effect-io-ai

Package: @effect/platform
Module: Url

Url.mutate

This function clones the original URL object and applies a callback to the clone, allowing multiple updates at once.

Example

import { Url } from "@effect/platform"

const myUrl = new URL("https://example.com")

const mutatedUrl = Url.mutate(myUrl, (url) => {
  url.username = "user"
  url.password = "pass"
})

console.log("Mutated:", mutatedUrl.toString())
// Output: Mutated: https://user:pass@example.com/

Signature

declare const mutate: { (f: (url: URL) => void): (self: URL) => URL; (self: URL, f: (url: URL) => void): URL; }

Source

Since v1.0.0