Join the URL segments and queries together, to create a normalized URL

Sohail · · 3409 Views
  • This snippet uses String.prototype.join('/') to combine URL segments.
  • It calls a series of String.prototype.replace() with various regexps to normalize the resulting URL (eliminate double slashes, add appropriate slashes for protocol, eliminate slashes before parameters, join parameters with & and standardize first parameter delimiter)

Please login or create new account to add your comment.

You may also like: