From 51b927235089a7840194780f6d18846aefbcabd3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 5 Oct 2026 01:04:50 +0200 Subject: [PATCH] Answer prose round 2: item 80 says what it names, the comment names its writer --- CHANGELOG.md | 5 +++-- src/json-value.ts | 2 +- todo.md | 14 +++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9dbce9..00ccb93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ - **Breaking:** an attribute value that is not a plain object, array or JSON primitive, such as a `Date`, `Map`, typed array or class instance, makes `isAdfDocument` return `false` and the - converters refuse it as `not-an-adf-document`, where it was written as `{}` or its own keys. - Build it as JSON holds it: `date.toISOString()`, `Object.fromEntries(map)`, `{ ...instance }`. + converters refuse it as `not-an-adf-document`. Before, the converters wrote it as `{}` or its own + keys. Build it as JSON holds it: `date.toISOString()`, `Object.fromEntries(map)`, + `Array.from(bytes)`, `{ ...instance }`. - The README opens with what the package does and for whom, and `package.json` carries search keywords. - The source moves to [github.com/larvit/adf-codec](https://github.com/larvit/adf-codec), where diff --git a/src/json-value.ts b/src/json-value.ts index 89cef47..cf7ef3b 100644 --- a/src/json-value.ts +++ b/src/json-value.ts @@ -19,7 +19,7 @@ export function isJsonValue(value: unknown): value is JsonValue { return true } -// Any realm's Object.prototype has a null prototype; a Date, Map or typed array would serialize as {} or a key per element. +// Any realm's Object.prototype has a null prototype; serializeCanonicalJson writes a Date or Map as {}. function isPlainObject(value: unknown): value is object { if (typeof value !== 'object' || value === null) return false const prototype: unknown = Object.getPrototypeOf(value) diff --git a/todo.md b/todo.md index 473a2cc..0e442ff 100644 --- a/todo.md +++ b/todo.md @@ -74,8 +74,8 @@ Lands after items 6, 59, 60, 61 and 62. The CommonMark spec suite also runs agai Today `null` and `undefined` throw a `TypeError` reading `length`, and `42` reads as an empty document. A JavaScript caller, or a TypeScript one past an untyped boundary, can pass any of these. No existing code reads true of a non-string input (`docs/decisions.md` §The code list), so the chunk -first asks the maintainer for one, proposing `not-a-string`. Found while checking the other ADF converters -for item 71, 2026-10-05. +first asks the maintainer for one, proposing `not-a-string`. Found while checking the other ADF +converters for item 71, 2026-10-05. ### 45. Replace `isAdfDocument` with a reader returning `Result`. @@ -134,11 +134,11 @@ read as `spec/flavour.md` says. Breaking: `MIGRATION.md` says which call a calle ### 80. Name the node's path and the attribute key when `not-an-adf-document` refuses a node inside the document. -Lands with items 45 and 77, whose reader walks every node. Today any refused node, a `Date` in one -attribute among them, reads `an ADF document's content holds ADF nodes: one of them is not` with an -empty `path`, so an export tool refusing one document in thousands searches the whole tree. Name -the key and the value's kind as the nesting message does. Found by the product-owner review of -items 66 and 67, 2026-10-05. +Lands with items 45 and 77, whose reader walks every node. Today every refused node, such as one +with a `Date` in an attribute, reads `an ADF document's content holds ADF nodes: one of them is not` +with an empty `path`. An export tool told this about one document in thousands then searches that +document's whole tree. Give the node's path, and name its type and the attribute key as +`attributeNestingMessage` does. Found by the product-owner review of items 66 and 67, 2026-10-05. ### 68. Carry a non-text inline node holding `content` or `text`, a block holding `text`, and a leaf block holding `content`.