https://github.com/risingstack/rising-url
Extends require('url').format() with parameters and easier inputs
https://github.com/risingstack/rising-url
Last synced: 7 months ago
JSON representation
Extends require('url').format() with parameters and easier inputs
- Host: GitHub
- URL: https://github.com/risingstack/rising-url
- Owner: RisingStack
- License: mit
- Created: 2014-10-30T09:28:26.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-22T15:28:43.000Z (over 10 years ago)
- Last Synced: 2025-04-07T18:48:07.876Z (9 months ago)
- Language: JavaScript
- Size: 164 KB
- Stars: 6
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
rising-url
==========
[](https://travis-ci.org/RisingStack/rising-url)
Extends require('url').format() with parameters and easier inputs
## Example
Options is compatible with the [url.format(urlObj)](http://nodejs.org/api/url.html)
plus accept the `param` field
```javascript
var url = require('rising-url');
url.format('..', ..., options);
```
```javascript
url.format('users/:user', ':page', {
param: {
user: 'john',
page: 'profile'
}
});
// -> 'users/john/profile'
```
```javascript
url.format('http://risingstack.com', 'users/:user', ':page', {
param: {
user: 'john',
page: 'profile'
},
query: {
limit: 100,
start: 10
},
hash: 'image'
});
// -> 'http://risingstack.com/users/john/profile?limit=100&start=10#image'
```