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 <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Trott authored Jan 25, 2022
1 parent 88a3bd5 commit 6023bed
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 6023bed

Please sign in to comment.