summaryrefslogtreecommitdiff
path: root/ext/url/lib.deno_url.d.ts
diff options
context:
space:
mode:
authorKamil Ogórek <kamil.ogorek@gmail.com>2023-03-13 15:26:58 +0100
committerGitHub <noreply@github.com>2023-03-13 15:26:58 +0100
commit58d8b2e98dbcf44e2282fccd1e50cc9b717edfd8 (patch)
tree419297f1a2a9ff5fed8bc70b90ff6e81e6454f89 /ext/url/lib.deno_url.d.ts
parent11f225ef7d8d51a048c11c57f47674e1c5bb6f3e (diff)
docs(ext): Update docs for URLPattern to make all examples work (#17870)
Diffstat (limited to 'ext/url/lib.deno_url.d.ts')
-rw-r--r--ext/url/lib.deno_url.d.ts22
1 files changed, 12 insertions, 10 deletions
diff --git a/ext/url/lib.deno_url.d.ts b/ext/url/lib.deno_url.d.ts
index 8d9404bc6..329f5bf55 100644
--- a/ext/url/lib.deno_url.d.ts
+++ b/ext/url/lib.deno_url.d.ts
@@ -236,7 +236,7 @@ declare interface URLPatternResult {
* ```ts
* // Specify the pattern as structured data.
* const pattern = new URLPattern({ pathname: "/users/:user" });
- * const match = pattern.exec("/users/joe");
+ * const match = pattern.exec("https://blog.example.com/users/joe");
* console.log(match.pathname.groups.user); // joe
* ```
*
@@ -249,9 +249,9 @@ declare interface URLPatternResult {
*
* ```ts
* // Specify a relative string pattern with a base URL.
- * const pattern = new URLPattern("/:article", "https://blog.example.com");
- * console.log(pattern.test("https://blog.example.com/article")); // true
- * console.log(pattern.test("https://blog.example.com/article/123")); // false
+ * const pattern = new URLPattern("/article/:id", "https://blog.example.com");
+ * console.log(pattern.test("https://blog.example.com/article")); // false
+ * console.log(pattern.test("https://blog.example.com/article/123")); // true
* ```
*
* @category Web APIs
@@ -262,13 +262,14 @@ declare class URLPattern {
/**
* Test if the given input matches the stored pattern.
*
- * The input can either be provided as a url string (with an optional base),
- * or as individual components in the form of an object.
+ * The input can either be provided as an absolute URL string with an optional base,
+ * relative URL string with a required base, or as individual components
+ * in the form of an `URLPatternInit` object.
*
* ```ts
* const pattern = new URLPattern("https://example.com/books/:id");
*
- * // Test a url string.
+ * // Test an absolute url string.
* console.log(pattern.test("https://example.com/books/123")); // true
*
* // Test a relative url with a base.
@@ -283,13 +284,14 @@ declare class URLPattern {
/**
* Match the given input against the stored pattern.
*
- * The input can either be provided as a url string (with an optional base),
- * or as individual components in the form of an object.
+ * The input can either be provided as an absolute URL string with an optional base,
+ * relative URL string with a required base, or as individual components
+ * in the form of an `URLPatternInit` object.
*
* ```ts
* const pattern = new URLPattern("https://example.com/books/:id");
*
- * // Match a url string.
+ * // Match an absolute url string.
* let match = pattern.exec("https://example.com/books/123");
* console.log(match.pathname.groups.id); // 123
*