PIbd-21_Zhirnova_A._E._Inte.../3 proba/node_modules/url-join
2023-12-06 21:05:45 +03:00
..
bin Lab3new 2023-12-06 21:05:45 +03:00
lib Lab3new 2023-12-06 21:05:45 +03:00
test Lab3new 2023-12-06 21:05:45 +03:00
.travis.yml Lab3new 2023-12-06 21:05:45 +03:00
CHANGELOG.md Lab3new 2023-12-06 21:05:45 +03:00
LICENSE Lab3new 2023-12-06 21:05:45 +03:00
package.json Lab3new 2023-12-06 21:05:45 +03:00
README.md Lab3new 2023-12-06 21:05:45 +03:00

Join all arguments together and normalize the resulting url.

Install

npm install url-join

Usage

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:

<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');
});

License

MIT