Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: clarify slashes-appending in url module
Refs: #9521
  • Loading branch information
Trott committed Nov 22, 2016
commit e9009d973acce35886a204d468aed564fb9a6965
10 changes: 6 additions & 4 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,12 @@ The formatting process operates as follows:
[`Error`][] is thrown.
* For all string values of `urlObject.protocol` that *do not end* with an ASCII
colon (`:`) character, the literal string `:` will be appended to `result`.
* If either the `urlObject.slashes` property is true, `urlObject.protocol`
begins with one of `http`, `https`, `ftp`, `gopher`, or `file`, or
`urlObject.protocol` is `undefined`, the literal string `//` will be appended
to `result`.
* If any of the following conditions is true, then the literal string `//` will
be appended to `result`:
* `urlObject.slashes` property is true;
* `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or
`file`;
* `urlObject.protocol` is `undefined`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct?

> url.format({ hostname: 'example.com' })
'example.com'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears not. I'll update it.

* If the value of the `urlObject.auth` property is truthy, and either
`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of
`urlObject.auth` will be coerced into a string and appended to `result`
Expand Down