@theholocron/uri-utils
v1.2.4
Published
Grab details from a URL.
Downloads
1,454
Readme
@theholocron/uri-utils
URL and search parameter utilities.
Installation
pnpm add @theholocron/uri-utilsUsage
import { getParam } from "@theholocron/uri-utils";
const url = "https://example.com/search?q=hello&page=2";
getParam(url, "q"); // "hello"
getParam(url, "page"); // "2"
getParam(url, "sort"); // nullgetParam(url, param)
Extracts a single query parameter from a URL string. Returns the parameter value as a string, null if the parameter is not present, or "" if the URL has no query string.
Documentation
Check out The Holocron Archive for more information.
