quasiurl
v1.1.8
Published
URL for templating
Readme
QuasiURL
URL-like object for templated URLs
Installation: npm i quasiurl
Unlike URL, QuasiURL:
- can have an empty
origin,pathname,hostname,protocol; - preserves templating characters without URL-encoding them;
- doesn't implement the entire
URLspec.
import { QuasiURL } from "quasiurl";
new URL("/x").href
// TypeError: URL constructor: /x is not a valid URL.
new QuasiURL("/x").href
// "/x"
new URL("https://a.aa/x{/:name}").pathname
// "/x%7B/:name%7D"
new QuasiURL("https://a.aa/x{/:name}").pathname
// "/x{/:name}"