3.1.4 • Published 1 year ago

@warren-bank/url v3.1.4

Weekly downloads
-
License
GPL-2.0
Repository
github
Last release
1 year ago

jsURL

Javascript drop-in replacement URL class library for Node.js and the browser.

The important difference is that this library does not perform any encoding or decoding. Further reading: 1

Class Import

  • in Node.js:

      npm install --save @warren-bank/url
      const {URL, parse} = require('@warren-bank/url')
    
      {
        const gh = new URL('https://github.com/warren-bank')
        const qs = gh.searchParams
    
        gh.username = 'user'
        gh.password = 'pass'
        gh.port     = 443
        gh.hash     = '#language-options'
    
        qs.set('tab', 'repositories')
    
        console.log('URL.href = '         + gh.href)
        console.log('parse(URL.href) = '  + JSON.stringify(parse(gh.href),  null, 2))
        console.log('parse(URL) = '       + JSON.stringify(parse(gh),       null, 2))
        console.log('parse(URL, true) = ' + JSON.stringify(parse(gh, true), null, 2))
      }
  • in the browser:

      <html>
      <head>
        <script src="https://cdn.jsdelivr.net/gh/warren-bank/js-url/es5-browser/jsURL.js"></script>
        <script>
          {
            // temporarily override global URL class with external implementation within scope of block
            const {URL, parse} = window.jsURL
    
            const gh = new URL('https://github.com/warren-bank')
            const qs = gh.searchParams
    
            gh.username = 'user'
            gh.password = 'pass'
            gh.port     = 443
            gh.hash     = '#language-options'
    
            qs.set('tab', 'repositories')
    
            window.alert('URL.href = '         + gh.href)
            window.alert('parse(URL.href) = '  + JSON.stringify(parse(gh.href),  null, 2))
            window.alert('parse(URL) = '       + JSON.stringify(parse(gh),       null, 2))
            window.alert('parse(URL, true) = ' + JSON.stringify(parse(gh, true), null, 2))
          }
        </script>
      </head>
      </html>

Limitations

The following methods are not implemented:

Legal

3.1.3

1 year ago

3.1.2

1 year ago

3.1.1

1 year ago

3.1.4

1 year ago

3.1.0

1 year ago

3.0.0

1 year ago

2.2.0

1 year ago

2.1.0

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago