Skip to content

Url Helpers

Utility functions for working with url operations.

Function Description
cleanPath Clean an URL by removing duplicate slashes.
extractPureURI Extracts the pure URI from a URL by removing query parameters and fragments.
onlyPath Extract only the path from an URI with optional query and fragments.
parsePackageRepository Parse the `repository` field from `package.json` into a structured object.
relativeURLToAbsolute Converts a relative URL to an absolute URL using the current document base URI.
withLeadingSlash Adds a leading slash `/` to the given URL if it is not already present.
withoutLeadingSlash Removes the leading slash `/` from the given URL if it is present.
withoutTrailingSlash Removes the trailing slash `/` from the given URL if it is present.
withTrailingSlash Adds a trailing slash `/` to the given URL if it is not already present.