cleanPath
Clean an URL by removing duplicate slashes. The protocol part of the URL is not modified.
Available since v1.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
url | string | null | undefined | The URL string to be processed. Can be string, undefined, or null. |
Returns
Section titled “Returns”string | null | undefined — The cleaned URL string, or undefined if the input is undefined, or null if the input is null.
Examples
Section titled “Examples”Remove duplicate slashes
Section titled “Remove duplicate slashes”Cleans an URL by removing duplicate slashes while preserving the protocol.
Preserve protocol
Section titled “Preserve protocol”The double slash after the protocol (http://) is not modified.
Handle null and undefined
Section titled “Handle null and undefined”Returns null for null input and undefined for undefined input.
