urlmodule

0.0.2 • Public • Published

urlmodule

work in progress

URLAssembler helps to assemble URLs.

See https://url.spec.whatwg.org/

Example

class GoogleUrl extends URLAssembler {
    static get url() {
        return 'https://www.google.com'
    }
}
const url = new GoogleUrl({
    pathname : 'recaptcha/api.js',
    searchParams : {
        render : 'explicit',
        onload : `ID${ Date.now() }_onload`,
        hl : document.body.lang
    }
})
console.log(url)

Result:

https://www.google.com/recaptcha/api.js?render=explicit&onload=ID1536188939748_onload&hl=ru

Installation

npm install urlmodule

License

The MIT License (MIT)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    1
  • 0.0.1
    0

Package Sidebar

Install

npm i urlmodule

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

4.59 kB

Total Files

5

Last publish

Collaborators

  • aristov