1.0.4 • Published 9 years ago

rising-url v1.0.4

Weekly downloads
6
License
MIT
Repository
github
Last release
9 years ago

rising-url

Build Status

Extends require('url').format() with parameters and easier inputs

Example

Options is compatible with the url.format(urlObj)
plus accept the param field

var url = require('rising-url');

url.format('..', ..., options);
url.format('users/:user', ':page', {
  param: {
    user: 'john',
    page: 'profile'
  }
});

// -> 'users/john/profile'
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'