diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cb2fa7..c9dbce9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,10 @@ ## Unreleased -- Fix an attribute value JSON does not hold — a `Date`, `Map`, `Set`, typed array or class instance — - passing `isAdfDocument` and converting as `{}`: it is `not-an-adf-document`. +- **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 }`. - 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/README.md b/README.md index 26d40c9..50770a7 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,7 @@ Emitting — `adfToMarkdown`, and `adfToHtml` at `0.2.0`: | Code | Fires when | What you can do | | --- | --- | --- | -| `not-an-adf-document` | the value handed in is no ADF document — a missing or wrong `type`, a stray key, a node that is not a node, an attribute value JSON does not hold — a `Date`, `Map` or class instance —, an object in the document holding itself | guard the boundary you receive JSON at with `isAdfDocument`; the message names the branch that refused | +| `not-an-adf-document` | the value handed in is no ADF document — a missing or wrong `type`, a stray key, a node that is not a node, an object in the document holding itself, an attribute value that is not a plain object, array or JSON primitive, such as a `Date` or `Map` | guard the boundary you receive JSON at with `isAdfDocument`; the message names the branch that refused. Build an attribute value as JSON holds it: `date.toISOString()`, `Object.fromEntries(map)`, `{ ...instance }` | | `unsupported-document-version` | the document's `version` is not 1 | keep the ADF and pass the document over, or show it read-only; the version is the site's, not yours to change | Either direction. The emitter's own refusals are in this group — a parse reaches them by asking it