Skip to content

Url Helpers

Utility functions for working with url operations.

FunctionDescription
cleanPathClean an URL by removing duplicate slashes.
extractPureURIExtracts the pure URI from a URL by removing query parameters and fragments.
onlyPathExtract only the path from an URI with optional query and fragments.
parsePackageRepositoryParse the repository field from package.json into a structured object.
relativeURLToAbsoluteConverts a relative URL to an absolute URL using the current document base URI.
withLeadingSlashAdds a leading slash / to the given URL if it is not already present.
withoutLeadingSlashRemoves the leading slash / from the given URL if it is present.
withoutTrailingSlashRemoves the trailing slash / from the given URL if it is present.
withTrailingSlashAdds a trailing slash / to the given URL if it is not already present.