Skip to content

Commit

Permalink
doc: revise url.resolve() text
Browse files Browse the repository at this point in the history
PR-URL: #41661
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Mestery <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
Trott authored and ruyadorno committed Feb 7, 2022
1 parent 986dbb3 commit a35c6c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -1585,11 +1585,11 @@ changes:

> Stability: 3 - Legacy: Use the WHATWG URL API instead.

* `from` {string} The Base URL being resolved against.
* `to` {string} The HREF URL being resolved.
* `from` {string} The base URL to use if `to` is a relative URL.
* `to` {string} The target URL to resolve.

The `url.resolve()` method resolves a target URL relative to a base URL in a
manner similar to that of a Web browser resolving an anchor tag HREF.
manner similar to that of a web browser resolving an anchor tag.

```js
const url = require('url');
Expand All @@ -1598,7 +1598,7 @@ url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
```

You can achieve the same result using the WHATWG URL API:
To achieve the same result using the WHATWG URL API:

```js
function resolve(from, to) {
Expand Down

0 comments on commit a35c6c3

Please sign in to comment.