Skip to content

extractPureURI

Extracts the pure URI from a URL by removing query parameters and fragments.

Available since v1.9.0

import { extractPureURI } from '@helpers4/url';
extractPureURI(url: string): string
ParameterTypeDescription
urlstringThe URL string to process

string — The URI without query parameters and fragments, or the original value if undefined/null

Strips everything after ? or # from the URL.

extractPureURI('https://example.com/path?query=1#section')
// => 'https://example.com/path'

View source on GitHub