node package manager
Painless code sharing. npm Orgs help your team discover, share, and reuse code. Create a free org »


extend-url build status

testling badge

Splits a url into its parts and adds or replaces items found in the parts of another url.

var extendUrl = require('extend-url');
var url1 = ''
  , url2 = ''
  , extended = extendUrl(url1, url2);


npm install extend-url


extendUrl(url1 : String, url2 : String) : String

Returns a url that extends url1 with url2 as follows:

  • protocol from url2
  • auth from url2 or url1 whichever is found first
  • pathname from url2
  • host from url2
  • search (query) url1's query extended with url2's query