![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | bin/ | 2 years ago | - | |
![]() | lib/ | 2 years ago | - | |
![]() | test/ | 2 years ago | - | |
![]() | CHANGELOG.md | 40 years ago | 6.1K | |
![]() | LICENSE | 40 years ago | 1.1K | |
![]() | README.md | 40 years ago | 745 | d7c1522 post receive test [كارل مبارك] |
![]() | package.json | 2 years ago | 1.5K |
Join all arguments together and normalize the resulting url.
npm install url-join
var urljoin = require('url-join');
var fullUrl = urljoin('http://www.google.com', 'a', '/b/cd', '?foo=123');
console.log(fullUrl);
Prints:
'http://www.google.com/a/b/cd?foo=123'
It also works in the browser, you can either include lib/url-join.js
in your page:
<script src="url-join.js"></script>
<script type="text/javascript">
urljoin('http://blabla.com', 'foo?a=1')
</script>
Or using an AMD module system like requirejs:
define(['path/url-join.js'], function (urljoin) {
urljoin('http://blabla.com', 'foo?a=1');
});
MIT