Skip to content

setPath

setPath(url, path) → string · URL

Set or replace the path component of a URL.

  • url (required): the URL string

  • path (required): new path to set

utlx
setPath("https://example.com/old/path", "/api/v2/resource")
// "https://example.com/api/v2/resource"

Released under AGPL-3.0.