doc: clarify url.format documentation

The original documentation was slightly confusing. It seemed that the
list of items described the properties of the urlObj object, while it
was actually describing the formatting process. This change makes this
clearer.

Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>

Cherry-picked-from: 0603c8345b
pull/281/merge
Julien Gilli 2015-01-10 21:41:12 +01:00 committed by Bert Belder
parent 3622f0308f
commit b91c535d86
1 changed files with 4 additions and 2 deletions

View File

@ -82,6 +82,8 @@ Pass `true` as the third argument to treat `//foo/bar` as
Take a parsed URL object, and return a formatted URL string. Take a parsed URL object, and return a formatted URL string.
Here's how the formatting process works:
* `href` will be ignored. * `href` will be ignored.
* `protocol` is treated the same with or without the trailing `:` (colon). * `protocol` is treated the same with or without the trailing `:` (colon).
* The protocols `http`, `https`, `ftp`, `gopher`, `file` will be * The protocols `http`, `https`, `ftp`, `gopher`, `file` will be
@ -97,9 +99,9 @@ Take a parsed URL object, and return a formatted URL string.
* `host` will be used in place of `hostname` and `port` * `host` will be used in place of `hostname` and `port`
* `pathname` is treated the same with or without the leading `/` (slash). * `pathname` is treated the same with or without the leading `/` (slash).
* `path` is treated the same with `pathname` but able to contain `query` as well. * `path` is treated the same with `pathname` but able to contain `query` as well.
* `search` will be used in place of `query`.
* `query` (object; see `querystring`) will only be used if `search` is absent. * `query` (object; see `querystring`) will only be used if `search` is absent.
* `search` is treated the same with or without the leading `?` (question mark). * `search` will be used in place of `query`.
* It is treated the same with or without the leading `?` (question mark).
* `hash` is treated the same with or without the leading `#` (pound sign, anchor). * `hash` is treated the same with or without the leading `#` (pound sign, anchor).
## url.resolve(from, to) ## url.resolve(from, to)