From 1d0df2377bc47b5a8db3eae51281443c090db814 Mon Sep 17 00:00:00 2001 From: George Hotelling Date: Mon, 3 Dec 2018 20:58:47 -0500 Subject: [PATCH 1/4] Add documentation for `safeDecodeURI()` and `filterURLForDisplay()` --- packages/url/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/url/README.md b/packages/url/README.md index 4c092d670fc9f..db6c2f49e5f6e 100644 --- a/packages/url/README.md +++ b/packages/url/README.md @@ -167,4 +167,19 @@ const newUrl = removeQueryArgs( 'https://wordpress.org?foo=bar&bar=baz&baz=fooba Removes one or more query string arguments from the given URL. +### safeDecodeURI + +```js +const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z' +``` +Safely decodes a URI with `decodeURI`. Returns the URI unmodified if `decodeURI` throws an error. + +### filterURLForDisplay + +```js +const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg +``` + +Returns a URL for display, without protocol, www subdomain or trailing slash. +

Code is Poetry.

From d4131c914ba83eeb55f2affd04efd66dfc58aa73 Mon Sep 17 00:00:00 2001 From: George Hotelling Date: Thu, 6 Dec 2018 20:32:34 -0500 Subject: [PATCH 2/4] Whitespace --- packages/url/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/url/README.md b/packages/url/README.md index db6c2f49e5f6e..823c5df1cf525 100644 --- a/packages/url/README.md +++ b/packages/url/README.md @@ -172,6 +172,7 @@ Removes one or more query string arguments from the given URL. ```js const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z' ``` + Safely decodes a URI with `decodeURI`. Returns the URI unmodified if `decodeURI` throws an error. ### filterURLForDisplay From b000fff333379622eb09ea55e35653c625a679db Mon Sep 17 00:00:00 2001 From: George Hotelling Date: Fri, 7 Dec 2018 09:36:59 -0500 Subject: [PATCH 3/4] =?UTF-8?q?Consistant=20Capit=E2=80=A6=20i=20mean=20ca?= =?UTF-8?q?pitalization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/url/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/url/README.md b/packages/url/README.md index 823c5df1cf525..de4b543673acb 100644 --- a/packages/url/README.md +++ b/packages/url/README.md @@ -173,7 +173,7 @@ Removes one or more query string arguments from the given URL. const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z' ``` -Safely decodes a URI with `decodeURI`. Returns the URI unmodified if `decodeURI` throws an error. +Safely decodes a URI with `decodeURI`. Returns the URI unmodified if `decodeURI` throws an Error. ### filterURLForDisplay From 98432432b89df11da75386cd90bc36f9c815d879 Mon Sep 17 00:00:00 2001 From: Chris Van Patten Date: Fri, 7 Dec 2018 09:37:12 -0500 Subject: [PATCH 4/4] Oxford comma Co-Authored-By: georgeh --- packages/url/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/url/README.md b/packages/url/README.md index de4b543673acb..fb78d8808bb2b 100644 --- a/packages/url/README.md +++ b/packages/url/README.md @@ -181,6 +181,6 @@ Safely decodes a URI with `decodeURI`. Returns the URI unmodified if `decodeURI` const displayUrl = filterURLForDisplay( 'https://www.wordpress.org/gutenberg/' ); // wordpress.org/gutenberg ``` -Returns a URL for display, without protocol, www subdomain or trailing slash. +Returns a URL for display, without protocol, www subdomain, or trailing slash.

Code is Poetry.