From e2a44edf34d7768c86473ccf31fcb27f33e71eaa Mon Sep 17 00:00:00 2001 From: uynilo9 Date: Sat, 21 Mar 2026 19:51:52 +0800 Subject: [PATCH 1/7] feat(frontmatter/unstable): add `test` to each subpackage, including JSON, TOML, and YAML --- front_matter/deno.json | 2 + front_matter/unstable_json.ts | 78 ++++++++++++++++++++++++++++++++++ front_matter/unstable_toml.ts | 80 +++++++++++++++++++++++++++++++++++ front_matter/unstable_yaml.ts | 38 +++++++++++++++++ 4 files changed, 198 insertions(+) create mode 100644 front_matter/unstable_json.ts create mode 100644 front_matter/unstable_toml.ts diff --git a/front_matter/deno.json b/front_matter/deno.json index ff70d0f7c4c1..443fda982885 100644 --- a/front_matter/deno.json +++ b/front_matter/deno.json @@ -8,6 +8,8 @@ "./test": "./test.ts", "./toml": "./toml.ts", "./yaml": "./yaml.ts", + "./unstable-json": "./unstable_json.ts", + "./unstable-toml": "./unstable_toml.ts", "./unstable-yaml": "./unstable_yaml.ts", "./types": "./types.ts" } diff --git a/front_matter/unstable_json.ts b/front_matter/unstable_json.ts new file mode 100644 index 000000000000..825542b373a2 --- /dev/null +++ b/front_matter/unstable_json.ts @@ -0,0 +1,78 @@ +// Copyright 2018-2026 the Deno authors. MIT license. +// This module is browser compatible. + +import { extractFrontMatter } from "./_shared.ts"; +import { EXTRACT_JSON_REGEXP } from "./_formats.ts"; +import type { Extract } from "./types.ts"; +import { test as _test } from "./test.ts"; + +export type { Extract }; + +/** + * Extracts and parses {@link https://www.json.org/ | JSON } from the metadata + * of front matter content. + * + * @example Extract JSON front matter + * ```ts + * import { extract } from "@std/front-matter/json"; + * import { assertEquals } from "@std/assert"; + * + * const output = `---json + * { "title": "Three dashes marks the spot" } + * --- + * Hello, world!`; + * const result = extract(output); + * + * assertEquals(result, { + * frontMatter: '{ "title": "Three dashes marks the spot" }', + * body: "Hello, world!", + * attrs: { title: "Three dashes marks the spot" }, + * }); + * ``` + * + * @typeParam T The type of the parsed front matter. + * @param text The text to extract JSON front matter from. + * @returns The extracted JSON front matter and body content. + */ +export function extract(text: string): Extract { + const { frontMatter, body } = extractFrontMatter(text, EXTRACT_JSON_REGEXP); + const attrs = (frontMatter ? JSON.parse(frontMatter) : {}) as T; + return { frontMatter, body, attrs }; +} + +/** + * Tests if a string has valid front matter. + * Supports {@link https://www.json.org/ | JSON}. + * + * @param str String to test. + * @returns `true` if the string has valid JSON front matter, otherwise `false`. + * + * @example Test for valid JSON front matter + * ```ts + * import { test } from "@std/front-matter/json"; + * import { assert } from "@std/assert"; + * + * const result = test( + * `---json + * {"title": "Three dashes followed by format marks the spot"} + * --- + * `); + * assert(result); + * ``` + * + * @example TOML front matter is not valid as JSON + * ```ts + * import { test } from "@std/front-matter/json"; + * import { assert } from "@std/assert"; + * + * const result = test( + * `---toml + * title = 'Three dashes followed by format marks the spot' + * --- + * `); + * assertFalse(result); + * ``` +*/ +export function test(str: string) { + return _test(str, ["json"]); +} diff --git a/front_matter/unstable_toml.ts b/front_matter/unstable_toml.ts new file mode 100644 index 000000000000..e4637376b1e2 --- /dev/null +++ b/front_matter/unstable_toml.ts @@ -0,0 +1,80 @@ +// Copyright 2018-2026 the Deno authors. MIT license. +// This module is browser compatible. + +import { extractFrontMatter } from "./_shared.ts"; +import { parse } from "@std/toml/parse"; +import type { Extract } from "./types.ts"; +import { EXTRACT_TOML_REGEXP } from "./_formats.ts"; +import { test as _test } from "./test.ts"; + +export type { Extract }; + +/** + * Extracts and parses {@link https://toml.io | TOML} from the metadata of + * front matter content. + * + * @example Extract TOML front matter + * ```ts + * import { extract } from "@std/front-matter/toml"; + * import { assertEquals } from "@std/assert"; + * + * const output = `---toml + * title = "Three dashes marks the spot" + * --- + * Hello, world!`; + * const result = extract(output); + * + * assertEquals(result, { + * frontMatter: 'title = "Three dashes marks the spot"', + * body: "Hello, world!", + * attrs: { title: "Three dashes marks the spot" }, + * }); + * ``` + * + * @typeParam T The type of the parsed front matter. + * @param text The text to extract TOML front matter from. + * @returns The extracted TOML front matter and body content. + */ +export function extract(text: string): Extract { + const { frontMatter, body } = extractFrontMatter(text, EXTRACT_TOML_REGEXP); + + const attrs = (frontMatter ? parse(frontMatter) : {}) as T; + return { frontMatter, body, attrs }; +} + +/** + * Tests if a string has valid TOML front matter. + * Supports {@link https://toml.io | TOML}. + * + * @param str String to test. + * @returns `true` if the string has valid TOML front matter, otherwise `false`. + * + * @example Test for valid TOML front matter + * ```ts + * import { test } from "@std/front-matter/toml"; + * import { assert } from "@std/assert"; + * + * const result = test( + * `---toml + * title = 'Three dashes followed by format marks the spot' + * --- + * `); + * assert(result); + * ``` + * + * @example JSON front matter is not valid as TOML + * ```ts + * import { test } from "@std/front-matter/toml"; + * import { assertFalse } from "@std/assert"; + * + * const result = test( + * `---json + * {"title": "Three dashes followed by format marks the spot"} + * --- + * `; + * assertFalse(result); + * ``` +*/ +export function test(str: string) { + return _test(str, ["toml"]); +} diff --git a/front_matter/unstable_yaml.ts b/front_matter/unstable_yaml.ts index 10532b9dbf78..3a3e0e2982cb 100644 --- a/front_matter/unstable_yaml.ts +++ b/front_matter/unstable_yaml.ts @@ -5,6 +5,7 @@ import { extractFrontMatter } from "./_shared.ts"; import { parse, type ParseOptions } from "@std/yaml/parse"; import type { Extract } from "./types.ts"; import { EXTRACT_YAML_REGEXP } from "./_formats.ts"; +import { test as _test } from "./test.ts"; export type { Extract }; @@ -42,3 +43,40 @@ export function extract(text: string, options?: ParseOptions): Extract { const attrs = parse(frontMatter, options) as T; return { frontMatter, body, attrs }; } + +/** + * Tests if a string has valid YAML front matter. + * Supports {@link https://yaml.org | YAML}. + * + * @param str String to test. + * @returns `true` if the string has valid YAML front matter, otherwise `false`. + * + * @example Test for valid YAML front matter + * ```ts + * import { test } from "@std/front-matter/yaml"; + * import { assert } from "@std/assert"; + * + * const result = test( + * `--- + * title: Three dashes marks the spot + * --- + * `); + * assert(result); + * ``` + * + * @example JSON front matter is not valid as YAML + * ```ts + * import { test } from "@std/front-matter/yaml"; + * import { assertFalse } from "@std/assert"; + * + * const result = test( + * `---json + * {"title": "Three dashes followed by format marks the spot"} + * --- + * `; + * assertFalse(result); + * ``` +*/ +export function test(str: string) { + return _test(str, ["yaml"]); +} From 20671f1161d84c732d8a83ca92a7fa470e78705b Mon Sep 17 00:00:00 2001 From: uynilo9 Date: Sat, 21 Mar 2026 19:59:51 +0800 Subject: [PATCH 2/7] style: format the code --- front_matter/unstable_json.ts | 2 +- front_matter/unstable_toml.ts | 2 +- front_matter/unstable_yaml.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/front_matter/unstable_json.ts b/front_matter/unstable_json.ts index 825542b373a2..e2c4d807e482 100644 --- a/front_matter/unstable_json.ts +++ b/front_matter/unstable_json.ts @@ -72,7 +72,7 @@ export function extract(text: string): Extract { * `); * assertFalse(result); * ``` -*/ + */ export function test(str: string) { return _test(str, ["json"]); } diff --git a/front_matter/unstable_toml.ts b/front_matter/unstable_toml.ts index e4637376b1e2..2ed8e125bc62 100644 --- a/front_matter/unstable_toml.ts +++ b/front_matter/unstable_toml.ts @@ -74,7 +74,7 @@ export function extract(text: string): Extract { * `; * assertFalse(result); * ``` -*/ + */ export function test(str: string) { return _test(str, ["toml"]); } diff --git a/front_matter/unstable_yaml.ts b/front_matter/unstable_yaml.ts index 3a3e0e2982cb..1b4d856fcd62 100644 --- a/front_matter/unstable_yaml.ts +++ b/front_matter/unstable_yaml.ts @@ -76,7 +76,7 @@ export function extract(text: string, options?: ParseOptions): Extract { * `; * assertFalse(result); * ``` -*/ + */ export function test(str: string) { return _test(str, ["yaml"]); } From 8da0e42bd43954295bec66bc00f823ea4e55c72c Mon Sep 17 00:00:00 2001 From: uynilo9 Date: Sat, 21 Mar 2026 20:05:25 +0800 Subject: [PATCH 3/7] fix: fix the missing return types and brackets --- front_matter/unstable_json.ts | 2 +- front_matter/unstable_toml.ts | 4 ++-- front_matter/unstable_yaml.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/front_matter/unstable_json.ts b/front_matter/unstable_json.ts index e2c4d807e482..4e24e501a714 100644 --- a/front_matter/unstable_json.ts +++ b/front_matter/unstable_json.ts @@ -73,6 +73,6 @@ export function extract(text: string): Extract { * assertFalse(result); * ``` */ -export function test(str: string) { +export function test(str: string): boolean { return _test(str, ["json"]); } diff --git a/front_matter/unstable_toml.ts b/front_matter/unstable_toml.ts index 2ed8e125bc62..7c1a0c1ce502 100644 --- a/front_matter/unstable_toml.ts +++ b/front_matter/unstable_toml.ts @@ -71,10 +71,10 @@ export function extract(text: string): Extract { * `---json * {"title": "Three dashes followed by format marks the spot"} * --- - * `; + * `); * assertFalse(result); * ``` */ -export function test(str: string) { +export function test(str: string): boolean { return _test(str, ["toml"]); } diff --git a/front_matter/unstable_yaml.ts b/front_matter/unstable_yaml.ts index 1b4d856fcd62..1c1b879e52b0 100644 --- a/front_matter/unstable_yaml.ts +++ b/front_matter/unstable_yaml.ts @@ -73,10 +73,10 @@ export function extract(text: string, options?: ParseOptions): Extract { * `---json * {"title": "Three dashes followed by format marks the spot"} * --- - * `; + * `); * assertFalse(result); * ``` */ -export function test(str: string) { +export function test(str: string): boolean { return _test(str, ["yaml"]); } From 83b0f5bae764ea1944a94399a96f01b1b7d079fb Mon Sep 17 00:00:00 2001 From: uynilo9 Date: Sat, 21 Mar 2026 20:51:58 +0800 Subject: [PATCH 4/7] fix: fix missing/wrong tags and imports --- front_matter/unstable_json.ts | 8 +++++--- front_matter/unstable_toml.ts | 6 ++++-- front_matter/unstable_yaml.ts | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/front_matter/unstable_json.ts b/front_matter/unstable_json.ts index 4e24e501a714..151e97190bcc 100644 --- a/front_matter/unstable_json.ts +++ b/front_matter/unstable_json.ts @@ -44,12 +44,14 @@ export function extract(text: string): Extract { * Tests if a string has valid front matter. * Supports {@link https://www.json.org/ | JSON}. * + * @experimental **UNSTABLE**: New API, yet to be vetted. + * * @param str String to test. * @returns `true` if the string has valid JSON front matter, otherwise `false`. * * @example Test for valid JSON front matter * ```ts - * import { test } from "@std/front-matter/json"; + * import { test } from "@std/front-matter/unstable-json"; * import { assert } from "@std/assert"; * * const result = test( @@ -62,8 +64,8 @@ export function extract(text: string): Extract { * * @example TOML front matter is not valid as JSON * ```ts - * import { test } from "@std/front-matter/json"; - * import { assert } from "@std/assert"; + * import { test } from "@std/front-matter/unstable-json"; + * import { assertFalse } from "@std/assert"; * * const result = test( * `---toml diff --git a/front_matter/unstable_toml.ts b/front_matter/unstable_toml.ts index 7c1a0c1ce502..d44f0b488d62 100644 --- a/front_matter/unstable_toml.ts +++ b/front_matter/unstable_toml.ts @@ -46,12 +46,14 @@ export function extract(text: string): Extract { * Tests if a string has valid TOML front matter. * Supports {@link https://toml.io | TOML}. * + * @experimental **UNSTABLE**: New API, yet to be vetted. + * * @param str String to test. * @returns `true` if the string has valid TOML front matter, otherwise `false`. * * @example Test for valid TOML front matter * ```ts - * import { test } from "@std/front-matter/toml"; + * import { test } from "@std/front-matter/unstable-toml"; * import { assert } from "@std/assert"; * * const result = test( @@ -64,7 +66,7 @@ export function extract(text: string): Extract { * * @example JSON front matter is not valid as TOML * ```ts - * import { test } from "@std/front-matter/toml"; + * import { test } from "@std/front-matter/unstable-toml"; * import { assertFalse } from "@std/assert"; * * const result = test( diff --git a/front_matter/unstable_yaml.ts b/front_matter/unstable_yaml.ts index 1c1b879e52b0..71dfb697993e 100644 --- a/front_matter/unstable_yaml.ts +++ b/front_matter/unstable_yaml.ts @@ -48,12 +48,14 @@ export function extract(text: string, options?: ParseOptions): Extract { * Tests if a string has valid YAML front matter. * Supports {@link https://yaml.org | YAML}. * + * @experimental **UNSTABLE**: New API, yet to be vetted. + * * @param str String to test. * @returns `true` if the string has valid YAML front matter, otherwise `false`. * * @example Test for valid YAML front matter * ```ts - * import { test } from "@std/front-matter/yaml"; + * import { test } from "@std/front-matter/unstable-yaml"; * import { assert } from "@std/assert"; * * const result = test( @@ -66,7 +68,7 @@ export function extract(text: string, options?: ParseOptions): Extract { * * @example JSON front matter is not valid as YAML * ```ts - * import { test } from "@std/front-matter/yaml"; + * import { test } from "@std/front-matter/unstable-yaml"; * import { assertFalse } from "@std/assert"; * * const result = test( From 848bea9af567fdd1c063d6ee42089696c8e5d4b0 Mon Sep 17 00:00:00 2001 From: uynilo9 Date: Sat, 21 Mar 2026 20:52:20 +0800 Subject: [PATCH 5/7] test: add tests for unstable features --- front_matter/json_test.ts | 19 +++++++++++++++++++ front_matter/toml_test.ts | 19 +++++++++++++++++++ front_matter/yaml_test.ts | 24 +++++++++++++++++++++++- 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/front_matter/json_test.ts b/front_matter/json_test.ts index 70cf511cbc54..d9ea98273914 100644 --- a/front_matter/json_test.ts +++ b/front_matter/json_test.ts @@ -1,9 +1,11 @@ // Copyright 2018-2026 the Deno authors. MIT license. +import { assert } from "@std/assert"; import { assertThrows } from "../assert/throws.ts"; import { extract } from "./json.ts"; import { assertEquals } from "@std/assert/equals"; +import { test as unstableTest } from "@std/front-matter/unstable-json"; Deno.test("json() extracts type error on invalid input", () => { assertThrows(() => extract("")); @@ -80,3 +82,20 @@ Deno.test("extractJson() throws at missing newline before body", () => { "Unexpected end of input", ); }); + +Deno.test("(unstable)test() handles valid json input", () => { + assert(unstableTest("---json\nname = 'deno'\n---\n")); + assert(unstableTest("= json =\nname = 'deno'\n= json =\n")); + assert(unstableTest("= json =\nname = 'deno'\n= json =\ndeno is awesome\n")); +}); + +Deno.test("(unstable)test() handles invalid json input", () => { + assert(!unstableTest("")); + assert(!unstableTest("---")); + assert(!unstableTest("---json")); + assert(!unstableTest("= json =")); + assert(!unstableTest("---\n")); + assert(!unstableTest("---json\n")); + assert(!unstableTest("= json =\n")); + assert(!unstableTest("---\nasdasdasd")); +}); diff --git a/front_matter/toml_test.ts b/front_matter/toml_test.ts index 9e4770ca15b8..bb2bafb96530 100644 --- a/front_matter/toml_test.ts +++ b/front_matter/toml_test.ts @@ -1,8 +1,10 @@ // Copyright 2018-2026 the Deno authors. MIT license. +import { assert } from "@std/assert"; import { assertThrows } from "../assert/throws.ts"; import { extract } from "./toml.ts"; import { assertEquals } from "@std/assert/equals"; +import { test as unstableTest } from "./unstable_toml.ts"; Deno.test("toml() extracts type error on invalid input", () => { assertThrows(() => extract("")); @@ -101,3 +103,20 @@ Deno.test("extractToml() throws at missing newline before body", () => { "Unexpected end of input", ); }); + +Deno.test("(unstable)test() handles valid toml input", () => { + assert(unstableTest("---toml\nname = 'deno'\n---\n")); + assert(unstableTest("= toml =\nname = 'deno'\n= toml =\n")); + assert(unstableTest("= toml =\nname = 'deno'\n= toml =\ndeno is awesome\n")); +}); + +Deno.test("(unstable)test() handles invalid toml input", () => { + assert(!unstableTest("")); + assert(!unstableTest("---")); + assert(!unstableTest("---toml")); + assert(!unstableTest("= toml =")); + assert(!unstableTest("---\n")); + assert(!unstableTest("---toml\n")); + assert(!unstableTest("= toml =\n")); + assert(!unstableTest("---\nasdasdasd")); +}); diff --git a/front_matter/yaml_test.ts b/front_matter/yaml_test.ts index d8d584d295b6..1a9ecfb0973d 100644 --- a/front_matter/yaml_test.ts +++ b/front_matter/yaml_test.ts @@ -1,7 +1,11 @@ // Copyright 2018-2026 the Deno authors. MIT license. import { extract } from "./yaml.ts"; -import { extract as unstableExtract } from "./unstable_yaml.ts"; +import { + extract as unstableExtract, + test as unstableTest, +} from "./unstable_yaml.ts"; +import { assert } from "../assert/mod.ts"; import { assertEquals } from "@std/assert/equals"; import { assertThrows } from "../assert/throws.ts"; @@ -126,3 +130,21 @@ Deno.test("extractYaml() throws at missing newline before body", () => { "Unexpected end of input", ); }); + +Deno.test("(unstable)test() handles valid yaml input", () => { + assert(unstableTest("---yaml\nname = 'deno'\n---\n")); + assert(unstableTest("= yaml =\nname = 'deno'\n= yaml =\n")); + assert(unstableTest("= yaml =\nname = 'deno'\n= yaml =\ndeno is awesome\n")); + assert(unstableTest("---\nname: deno\n---\n")); +}); + +Deno.test("(unstable)test() handles invalid yaml input", () => { + assert(!unstableTest("")); + assert(!unstableTest("---")); + assert(!unstableTest("---yaml")); + assert(!unstableTest("= yaml =")); + assert(!unstableTest("---\n")); + assert(!unstableTest("---yaml\n")); + assert(!unstableTest("= yaml =\n")); + assert(!unstableTest("---\nasdasdasd")); +}); From b1ad71afe535177a35184b323fe42c391521861a Mon Sep 17 00:00:00 2001 From: uynilo9 Date: Wed, 25 Mar 2026 23:20:58 +0800 Subject: [PATCH 6/7] fix: remove duplicate function export --- front_matter/unstable_json.ts | 37 --------------------------------- front_matter/unstable_toml.ts | 39 ----------------------------------- 2 files changed, 76 deletions(-) diff --git a/front_matter/unstable_json.ts b/front_matter/unstable_json.ts index 151e97190bcc..45c7a2bf42f4 100644 --- a/front_matter/unstable_json.ts +++ b/front_matter/unstable_json.ts @@ -1,45 +1,8 @@ // Copyright 2018-2026 the Deno authors. MIT license. // This module is browser compatible. -import { extractFrontMatter } from "./_shared.ts"; -import { EXTRACT_JSON_REGEXP } from "./_formats.ts"; -import type { Extract } from "./types.ts"; import { test as _test } from "./test.ts"; -export type { Extract }; - -/** - * Extracts and parses {@link https://www.json.org/ | JSON } from the metadata - * of front matter content. - * - * @example Extract JSON front matter - * ```ts - * import { extract } from "@std/front-matter/json"; - * import { assertEquals } from "@std/assert"; - * - * const output = `---json - * { "title": "Three dashes marks the spot" } - * --- - * Hello, world!`; - * const result = extract(output); - * - * assertEquals(result, { - * frontMatter: '{ "title": "Three dashes marks the spot" }', - * body: "Hello, world!", - * attrs: { title: "Three dashes marks the spot" }, - * }); - * ``` - * - * @typeParam T The type of the parsed front matter. - * @param text The text to extract JSON front matter from. - * @returns The extracted JSON front matter and body content. - */ -export function extract(text: string): Extract { - const { frontMatter, body } = extractFrontMatter(text, EXTRACT_JSON_REGEXP); - const attrs = (frontMatter ? JSON.parse(frontMatter) : {}) as T; - return { frontMatter, body, attrs }; -} - /** * Tests if a string has valid front matter. * Supports {@link https://www.json.org/ | JSON}. diff --git a/front_matter/unstable_toml.ts b/front_matter/unstable_toml.ts index d44f0b488d62..69299ba5aa0f 100644 --- a/front_matter/unstable_toml.ts +++ b/front_matter/unstable_toml.ts @@ -1,47 +1,8 @@ // Copyright 2018-2026 the Deno authors. MIT license. // This module is browser compatible. -import { extractFrontMatter } from "./_shared.ts"; -import { parse } from "@std/toml/parse"; -import type { Extract } from "./types.ts"; -import { EXTRACT_TOML_REGEXP } from "./_formats.ts"; import { test as _test } from "./test.ts"; -export type { Extract }; - -/** - * Extracts and parses {@link https://toml.io | TOML} from the metadata of - * front matter content. - * - * @example Extract TOML front matter - * ```ts - * import { extract } from "@std/front-matter/toml"; - * import { assertEquals } from "@std/assert"; - * - * const output = `---toml - * title = "Three dashes marks the spot" - * --- - * Hello, world!`; - * const result = extract(output); - * - * assertEquals(result, { - * frontMatter: 'title = "Three dashes marks the spot"', - * body: "Hello, world!", - * attrs: { title: "Three dashes marks the spot" }, - * }); - * ``` - * - * @typeParam T The type of the parsed front matter. - * @param text The text to extract TOML front matter from. - * @returns The extracted TOML front matter and body content. - */ -export function extract(text: string): Extract { - const { frontMatter, body } = extractFrontMatter(text, EXTRACT_TOML_REGEXP); - - const attrs = (frontMatter ? parse(frontMatter) : {}) as T; - return { frontMatter, body, attrs }; -} - /** * Tests if a string has valid TOML front matter. * Supports {@link https://toml.io | TOML}. From bc74fa04c177c440b24f1ce01dcf7cd1a6522aa8 Mon Sep 17 00:00:00 2001 From: uynilo9 Date: Wed, 25 Mar 2026 23:22:13 +0800 Subject: [PATCH 7/7] style: apply consistent import style --- front_matter/json_test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front_matter/json_test.ts b/front_matter/json_test.ts index d9ea98273914..76265c1d75a9 100644 --- a/front_matter/json_test.ts +++ b/front_matter/json_test.ts @@ -5,7 +5,7 @@ import { assertThrows } from "../assert/throws.ts"; import { extract } from "./json.ts"; import { assertEquals } from "@std/assert/equals"; -import { test as unstableTest } from "@std/front-matter/unstable-json"; +import { test as unstableTest } from "./unstable_json.ts"; Deno.test("json() extracts type error on invalid input", () => { assertThrows(() => extract(""));