Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created August 6, 2012 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/3277318 to your computer and use it in GitHub Desktop.
Save isaacs/3277318 to your computer and use it in GitHub Desktop.
> o={protocol:'http:',host:'wrong.com:123',port:123,hostname:'right.com',path:'/wrong?wrong=wrong',pathname:'/right',search:'?x=z'}
{ protocol: 'http:',
host: 'wrong.com:123',
port: 123,
hostname: 'right.com',
path: '/wrong?wrong=wrong',
pathname: '/right',
search: '?x=z' }
> url.format(o)
'http://wrong.com:123/right?x=z'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment