doc: add url.resolve() usage examples

Fixes #4913.
This commit is contained in:
Ben Noordhuis 2013-03-04 20:54:34 +01:00
parent a6a1659d85
commit ecf9f606c9
1 changed files with 5 additions and 1 deletions

View File

@ -96,4 +96,8 @@ Take a parsed URL object, and return a formatted URL string.
## url.resolve(from, to)
Take a base URL, and a href URL, and resolve them as a browser would for
an anchor tag.
an anchor tag. Examples:
url.resolve('/one/two/three', 'four') // '/one/two/four'
url.resolve('http://example.com/', '/one') // 'http://example.com/one'
url.resolve('http://example.com/one', '/two') // 'http://example.com/two'