Neologistic Paraphasic Mumbling

    url-join
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/url-join package

    4.0.1 • Public • Published

    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

    Keywords

    Install

    npm i url-join

    DownloadsWeekly Downloads

    3,970,412

    Version

    4.0.1

    License

    MIT

    Unpacked Size

    18.3 kB

    Total Files

    8

    Last publish

    Collaborators

    • jfromaniello