Napoleon's Pixelated Mugshot

    This package has been deprecated

    Author message:

    Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

    browser-url

    2.0.1 • Public • Published

    Url

    URL utility for browser.

    See x-url for cross-platform URL utility.

    // use current location
    var url = new Url();
    console.log('current location', url);
     
    url = new Url('http://www.example.com/foo/bar?a=1&b=2#p2');
    console.log('http://www.example.com/foo/bar?a=1&b=2#p2', url);
    console.log('href:', url.href);
    console.log('protocol: ', url.protocol);
    console.log('host:', url.host);
    console.log('hostname:', url.hostname);
    console.log('port:', url.port);
    console.log('pathname:', url.pathname);
    console.log('search:', url.search);
    console.log('hash:', url.hash);
    console.log('query:', url.query);
     
    url.query.foo = 'bar';
    console.log(url.href);
     
    console.log(url.addQuery('one', 1).addQuery({
      two: 2,
      foo: 3
    }).removeQuery('a', 'b').href);
     
    console.log(url.setQuery({
      foo: 1,
      bar: 2
    }).set('hash', '#p1').href);
     
    console.log(url.set('search', '?foo=2&bar=3').query);
    console.log(url.sortQuery().href);

    License

    MIT

    Keywords

    Install

    npm i browser-url

    DownloadsWeekly Downloads

    626

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    17.7 kB

    Total Files

    8

    Last publish

    Collaborators

    • jiangfengming