open-url-js

1.0.30 • Public • Published

Open URL JS 🔍

npm version Maintainability

Simply manage urls.

Install

npm install open-url-js

Usage

var Url = require('open-url-js');
 
var url = new Url('https://www.myapp.com:3000/users/:id/#profile?user[lang]=fr');
url;
// => Url {
//      protocol: 'https',
//      host: 'www.myapp.com',
//      port: 3000,
//      path: Pathname ['users', ':id', root: true],
//      hash: 'profile',
//      parameters: Parameters {
//        user: Parameters {
//          lang: fr
//        }
//      }
//    }
 
url.path.id = 4;
url.string;
// => 'https://www.myapp.com:3000/users/4/#profile?user[lang]=fr';
 
url.parameters = {
  lang: 'en',
  zone: 'United States'
};
url.string;
// => 'https://www.myapp.com:3000/users/4/#profile?lang=fr&zone=United%20States';

Url

Kind: global class

new Url(...string)

Create a Url object.

Param Type Description
...string Object Same value as string.

url.string : string

A string corresponding to the url. When set, it will be parsed.

Kind: instance property of Url

url.protocol : string

The protocol of the url.

Kind: instance property of Url

url.host : string

The host of the url.

Kind: instance property of Url

url.port : string

The port of the url.

Kind: instance property of Url

url.hash : string

The hash of the url.

Kind: instance property of Url

url.path : Pathname

The path of the url.

Kind: instance property of Url

url.parameters : Parameters

The parameters of the url.

Kind: instance property of Url

url.clear() ⇒ Url

Clears the url.

Kind: instance method of Url
Returns: Url - Itself.

url.toString() ⇒ string

Kind: instance method of Url
Returns: string - Value of string.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.300latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.300
1.0.290
1.0.280
1.0.270
1.0.260
1.0.250
1.0.240
1.0.230
1.0.220
1.0.210
1.0.200
1.0.190
1.0.180
1.0.170
1.0.160
1.0.150
1.0.140
1.0.130
1.0.120
1.0.110
1.0.100
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i open-url-js

Weekly Downloads

0

Version

1.0.30

License

MIT

Unpacked Size

14.1 kB

Total Files

9

Last publish

Collaborators

  • juliendargelos