From 06b8799ce416b05bd0fea25951e39a3bd77e3a18 Mon Sep 17 00:00:00 2001 From: recrack Date: Mon, 6 Mar 2023 16:20:41 +0900 Subject: [PATCH] doc: fix myUrl is not defined in url Fixes a typo in the variable name in the URL code example in doc. Renames `myUrl` to `myURL` for consistency and readability. --- doc/api/url.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/url.md b/doc/api/url.md index 186220d0dbb825..a3ea03ba5b4118 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -554,14 +554,14 @@ instance, the `URL` object will not percent encode the ASCII tilde (`~`) character, while `URLSearchParams` will always encode it: ```js -const myUrl = new URL('https://example.org/abc?foo=~bar'); +const myURL = new URL('https://example.org/abc?foo=~bar'); -console.log(myUrl.search); // prints ?foo=~bar +console.log(myURL.search); // prints ?foo=~bar // Modify the URL via searchParams... -myUrl.searchParams.sort(); +myURL.searchParams.sort(); -console.log(myUrl.search); // prints ?foo=%7Ebar +console.log(myURL.search); // prints ?foo=%7Ebar ``` #### `url.username` @@ -1271,7 +1271,7 @@ console.log(urlToHttpOptions(myURL)); const { urlToHttpOptions } = require('node:url'); const myURL = new URL('https://a:b@測試?abc#foo'); -console.log(urlToHttpOptions(myUrl)); +console.log(urlToHttpOptions(myURL)); /* { protocol: 'https:',