aboutsummaryrefslogtreecommitdiff
path: root/node_modules/url-join/README.md
blob: 13012c8d3bb7818d730b87af03e4dba6db81b30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Join all arguments together and normalize the resulting url.

## Install

~~~
npm install url-join
~~~

## Usage

~~~javascript
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'
~~~

## Browser and AMD

It also works in the browser, you can either include ```lib/url-join.js``` in your page:

~~~html
<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:

~~~javascript
define(['path/url-join.js'], function (urljoin) {
  urljoin('http://blabla.com', 'foo?a=1');
});
~~~

## License

MIT