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

Sohail · · 3220 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)
0

Please login or create new account to add your comment.

0 comments
You may also like: