1.0.30 • Published 6 years ago

open-url-js v1.0.30

Weekly downloads
4
License
MIT
Repository
-
Last release
6 years ago

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.

ParamTypeDescription
...stringObjectSame 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.

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago