You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
571 B

var url = require('url'),
urls = [
'http://nodejs.org/docs/latest/api/url.html#url_url_format_urlobj',
'http://blog.nodejs.org/',
'https://encrypted.google.com/search?q=url&q=site:npmjs.org&hl=en',
'javascript:alert("node is awesome");',
'some.ran/dom/url.thing?oh=yes#whoo'
],
paths = [
'../foo/bar?baz=boom',
'foo/bar',
'http://nodejs.org',
'./foo/bar?baz'
];
urls.forEach(url.parse);
urls.forEach(url.format);
urls.forEach(function(u){
paths.forEach(function(p){
url.resolve(u, p);
});
});