Skip to content

docs: rewrite the README in simpler English and fix inaccuracies - #14

Merged
milamer merged 1 commit into
mainfrom
docs/fix-readme-jsdoc
Nov 9, 2026
Merged

milamer merged 1 commit into
mainfrom
docs/fix-readme-jsdoc

Conversation

@milamer

@milamer milamer commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Rewrites the README so it's shorter to scan and easier to read for non-native speakers, and fixes what was inaccurate or missing. It must go in before the 1.1.0 release, because the README and the JSDoc ship in the package.

Style

  • Layout follows small packages known for short docs (sindresorhus's packages, nanoid, ky): a pitch with one example, then Install, Usage and an API section where each option has Type:/Default:. Reference material is in tables (field-name syntax, errors).
  • Wording follows Simplified Technical English (ASD-STE100) rules where it makes sense: short sentences with one idea each, active voice, present tense, and one term per concept. Field name, path and path part are defined once and then used consistently.

Content changes

  • "A tiny node module" → works in all modern runtimes; new Supported runtimes section.
  • New Errors section: when each error (and the depth TypeError) is thrown; that key is the path up to the failing part, cut to 100 characters plus ... in ForbiddenKeyError/DepthLimitError; that key is the path after transformEntry (+a.b.c with depth: 2 → DepthLimitError('a.b.c')), so code that maps it back to a form field must undo its own transform; order of errors.
  • New Security section collecting the __proto__ and Object.prototype notes, plus a pointer to depth.
  • Newly documented, with unchanged behavior: + with an empty string gives 0; & is true for any number other than 0; an unchecked checkbox sends nothing; URLSearchParams works as input.
  • The qs mentions are gone (README, parseFormData JSDoc, the path-parts.ts comment, a test comment).
  • The parseFormData JSDoc says that key is the path after transformEntry.
  • The TOC is regenerated with npm run build:toc.

The other JSDoc fixes in the plan (defaultTransform as the second argument, the block-body arrow, the unclosed fence, getSetterAndGetter, "missmatching") were already fixed on main by earlier PRs.

Verification

  • Every README example was run against the built CJS file, and each output matches the README.
  • Runtime claims: scripts/smoke-dist.mjs passes on Bun and Deno (Deno needs --unstable-detect-cjs for the CJS build, which is normal for packages without a type field). The ESM build parses FormData with a native File in Deno, and Bun gives the same README example output as Node.
  • npm run validate passes.

Not included: a date-parsing recipe for #3. transformEntry can't return a Date in TypeScript (its return type is JsonLeafValue), so that needs a decision first. #3 stays open.

Restructure the README into Install, Usage, Field names, API, Errors,
Security and Supported runtimes, with short sentences and one term per
concept (field name, path, path part).

- Say the library works in all modern runtimes instead of "a tiny node
  module", and list the runtimes.
- Add an Errors section: when each error is thrown, what `key` holds,
  that it's cut to 100 characters for ForbiddenKeyError and
  DepthLimitError, and that it's the path after transformEntry.
- Document `+''` => 0, numbers other than 0 for `&`, unchecked
  checkboxes, and URLSearchParams as input.
- Remove the qs mentions from the README, JSDoc and comments.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (37580df) to head (2d204c5).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #14   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          125       125           
  Branches        44        44           
=========================================
  Hits           125       125           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@milamer
milamer merged commit 1ece858 into main Nov 9, 2026
7 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants