Skip to content

kaerus-component/urlparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

URL

Provides with an Url parser that deconstructs an url into a managable object and back to a string.

Examples:

   url = require('urlparser');
   
   var u = url.parse('http://user:[email protected]/login?x=42');
   
   u.host.hostname = 'database.kaerus.com'
   u.host.password = 'secret';
   u.host.port = 8529;
   u.query.parts.push('a=13');
   u.toString(); // 'http://user:[email protected]:8529/login?x=42&a=13'

UrlParser()

@class UrlParser

ret.host

Host attributes

   host: {
       protocol: {String}
       username: {String}
       password: {String}
       hostname: {String}
       port: {String}
   }

ret.path

Path information

   path: {
       base: {String} // base path without hash
       name: {String} // file or directory name
       hash: {String} // the #hash part in path
   }

ret.query

Query parameters

   query: {
       parts: {Array}   // query segments ['a=3','x=2'] 
       params: {Object} // query parameters {a:3,x:2}
   }