Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juliendargelos/open-url-js
Simply manage urls.
https://github.com/juliendargelos/open-url-js
Last synced: 4 days ago
JSON representation
Simply manage urls.
- Host: GitHub
- URL: https://github.com/juliendargelos/open-url-js
- Owner: juliendargelos
- Created: 2017-12-02T19:15:58.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-18T19:29:59.000Z (almost 7 years ago)
- Last Synced: 2024-11-10T01:46:12.786Z (2 months ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.hbs
Awesome Lists containing this project
README
# Open URL JS 🔍
[![npm version](https://badge.fury.io/js/open-url-js.svg)](https://badge.fury.io/js/open-url-js)
[![Maintainability](https://api.codeclimate.com/v1/badges/27a140e4e8a692f19938/maintainability)](https://codeclimate.com/github/juliendargelos/open-url-js/maintainability)Simply manage urls.
## Install
```
npm install open-url-js
```## Usage
```javascript
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';
```{{>main}}