Skip to content

docs: update README to reflect current API surface#75

Merged
jan-kubica merged 2 commits intomainfrom
docs/update-readme
Mar 25, 2026
Merged

docs: update README to reflect current API surface#75
jan-kubica merged 2 commits intomainfrom
docs/update-readme

Conversation

@jan-kubica
Copy link
Copy Markdown
Contributor

@jan-kubica jan-kubica commented Mar 25, 2026

Summary

  • Expanded country table from 4 examples to all 97 supported countries (collapsible)
  • Added missing international validators: BIC, ISIN, EU VAT
  • Documented full Validator type including optional properties (description, sourceUrl, lengths, examples, generate, aliases, candidatePattern)
  • Listed all 23 validators with parse() support (was only cz.rc)
  • Documented detectNetwork() and CardNetwork type from creditcard module
  • Updated test count: 76 → 4,185

Test plan

  • Verify markdown renders correctly on GitHub (tables, collapsible section)
  • Spot-check a few country module paths against actual exports

Open with Devin

The README was severely outdated: documented 4 countries (97
supported), 3 international validators (7 exist), a minimal
Validator type (missing 7 optional properties), and 76 tests
(now 4,185). Updated all sections to match the actual codebase.
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 25, 2026

Greptile Summary

This PR significantly expands the README to reflect the current API surface: it grows the country table from 4 examples to all 96 supported countries (in a collapsible section), adds the previously undocumented international validators (bic, isin, eu/vat), documents the full Validator type with optional fields, lists all 23 validators that expose parse(), and fixes the detectNetwork usage example to use the correct top-level import.

Key changes:

  • Country table expanded from 4 to 96 entries inside a <details> collapsible block
  • International section updated to include bic, isin, creditcard, and eu/vat
  • Validator type updated with all optional metadata properties (description, sourceUrl, lengths, examples, generate, aliases, candidatePattern)
  • parse() support documented for 23 validators
  • detectNetwork() and CardNetwork now shown with the correct top-level import syntax
  • Test count updated from 76 → 4,185

Issue found:

  • Three country namespaces clash with JavaScript/TypeScript reserved keywords and are exported under underscore-suffixed aliases (do_, in_, is_) in src/index.ts. The README does not document this, so users following the standard import { cz } from "@stll/stdnum" pattern for Dominican Republic (do), India (in), or Iceland (is) will receive a compile-time SyntaxError or silently get undefined. A short note near the countries table would prevent this confusion.

Confidence Score: 3/5

  • Safe to merge after adding a note about the do_, in_, is_ reserved-keyword export aliases — without it, the README actively misleads users for three country namespaces.
  • The PR is documentation-only and most of its content is accurate and well-structured. The detectNetwork fix and country count (96) are both correct. The one substantive issue — undocumented reserved-keyword aliases — will cause real runtime/compile errors for users of the Dominican Republic, India, and Iceland namespaces, which warrants withholding a full green score.
  • README.md — specifically the countries table entries for DO (line 119), IN (line 154), and IS (line 159) where the reserved-keyword export aliases are not documented.

Important Files Changed

Filename Overview
README.md Expanded country table to 96 entries, added international validators (BIC, ISIN, EU VAT), documented full Validator type, listed all 23 parse()-supporting validators, and fixed detectNetwork usage. One logic issue: the reserved-keyword export aliases (do_, in_, is_) are not documented, which will confuse users attempting to import those namespaces.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    PKG["@stll/stdnum"]

    PKG --> INTL["International validators\nbic · creditcard · iban · isin · lei · luhn · eu/vat"]
    PKG --> COUNTRIES["Country namespaces\n96 countries (ad … za)"]
    PKG --> TOPEXPORTS["Top-level named exports\ndetectNetwork()\nCardNetwork type"]

    COUNTRIES --> NORMAL["Standard names\n(cz, de, pl, …)\nimport { cz } from '@stll/stdnum'"]
    COUNTRIES --> RESERVED["Reserved-keyword aliases\ndo_ · in_ · is_\nimport { do_, in_, is_ } from '@stll/stdnum'"]

    INTL --> VALIDATOR["Validator interface\ncompact · format · validate\n+ optional: generate · parse · examples · …"]
    NORMAL --> VALIDATOR
    RESERVED --> VALIDATOR

    VALIDATOR --> PARSE["parse() — 23 validators\nreturns structured data\ne.g. { birthDate, gender }"]
Loading

Reviews (2): Last reviewed commit: "fix: correct detectNetwork usage and cou..." | Re-trigger Greptile

greptile-apps[bot]

This comment was marked as resolved.

- detectNetwork is a top-level named export, not a method on
  the creditcard validator object
- Country count is 96 (eu is in International section, not a
  country namespace)
@jan-kubica
Copy link
Copy Markdown
Contributor Author

Both confidence score concerns addressed in 25988cb:

  1. detectNetwork usage — accepted. Fixed the example to show detectNetwork as a top-level named import rather than a method on the creditcard object.

  2. Country count 97 → 96 — accepted. The eu namespace is correctly listed under International, not as a country. Updated the heading to 96.

CC on behalf of @jan-kubica

@jan-kubica jan-kubica marked this pull request as ready for review March 25, 2026 19:47
@jan-kubica jan-kubica merged commit 9235859 into main Mar 25, 2026
4 of 5 checks passed
@jan-kubica jan-kubica deleted the docs/update-readme branch March 25, 2026 19:47
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant