From d2c74bfbb703ee218dfdfa341735fc36021101c8 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Tue, 30 May 2017 00:25:41 +0300 Subject: [PATCH 1/3] doc: update outputs of code examples in url.md --- doc/api/url.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/api/url.md b/doc/api/url.md index 06a5618949bf7f..173568812fb00a 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -332,7 +332,7 @@ console.log(myURL.protocol); myURL.protocol = 'ftp'; console.log(myURL.href); - // Prints ftp://example.org + // Prints ftp://example.org/ ``` Invalid URL protocol values assigned to the `protocol` property are ignored. @@ -380,7 +380,7 @@ console.log(myURL.username); myURL.username = '123'; console.log(myURL.href); - // Prints https://123:xyz@example.com + // Prints https://123:xyz@example.com/ ``` Any invalid URL characters appearing in the value assigned the `username` @@ -515,7 +515,7 @@ const params = new URLSearchParams({ query: ['first', 'second'] }); console.log(params.getAll('query')); - // Prints ['first,second'] + // Prints [ 'first,second' ] console.log(params.toString()); // Prints 'user=abc&query=first%2Csecond' ``` @@ -571,7 +571,8 @@ console.log(params.toString()); new URLSearchParams([ ['user', 'abc', 'error'] ]); - // Throws TypeError: Each query pair must be a name/value tuple + // Throws TypeError [ERR_INVALID_TUPLE]: + // Each query pair must be an iterable [name, value] tuple ``` #### urlSearchParams.append(name, value) @@ -817,7 +818,7 @@ console.log(myURL.toString()); // Prints https://a:b@xn--6qqa088eba/?abc#foo console.log(url.format(myURL, {fragment: false, unicode: true, auth: false})); - // Prints 'https://你好你好?abc' + // Prints 'https://你好你好/?abc' ``` ## Legacy URL API From a1c961dd4c3e399fa22089f952c0c6d2f69977a2 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Tue, 30 May 2017 00:26:46 +0300 Subject: [PATCH 2/3] doc: refine spaces in code examples of url.md --- doc/api/url.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/url.md b/doc/api/url.md index 173568812fb00a..016b2bda1dae11 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -101,7 +101,7 @@ that an effort will be made to coerce the given values into strings. For instance: ```js -const myURL = new URL({toString: () => 'https://example.org/'}); +const myURL = new URL({ toString: () => 'https://example.org/' }); // https://example.org/ ``` @@ -817,7 +817,7 @@ console.log(myURL.href); console.log(myURL.toString()); // Prints https://a:b@xn--6qqa088eba/?abc#foo -console.log(url.format(myURL, {fragment: false, unicode: true, auth: false})); +console.log(url.format(myURL, { fragment: false, unicode: true, auth: false })); // Prints 'https://你好你好/?abc' ``` From baa7c0c3673032b9bd7f8fc18e3c4e5d44d5ba8c Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Tue, 30 May 2017 00:27:56 +0300 Subject: [PATCH 3/3] doc: restore missing part in example of url.md --- doc/api/url.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/url.md b/doc/api/url.md index 016b2bda1dae11..a74ca26e08f919 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -186,6 +186,7 @@ console.log(myURL.href); // Prints https://example.org/foo myURL.href = 'https://example.com/bar'; +console.log(myURL.href); // Prints https://example.com/bar ```