Skip to content

v1.1.0: forgiving numberstring(), language fixes, Netlify playground - #12

Merged
brianfunk merged 5 commits into
devfrom
feat/forgiving-api-playground
Oct 6, 2026
Merged

brianfunk merged 5 commits into
devfrom
feat/forgiving-api-playground

Conversation

@brianfunk

Copy link
Copy Markdown
Owner

Summary

  • Forgiving default export. numberstring(-5), numberstring(1.5), numberstring('42'), and numberstring(42, { lang: 'es' }) all work now by delegating to negative(), decimal(), and toWords(). Invalid input still returns false. Negatives/decimals with a non-English lang return false instead of silently falling back to English.
  • Language fixes: Spanish cien / un millón / veintiún mil; French deux millions, deux cent mille, quatre-vingt mille; Italian ventunmila; Japanese 二万一千; Icelandic gender agreement (tvö þúsund, ein milljón, tvær milljónir).
  • Bug fixes: decimal(1e21) returned "one"; parse('nineteen eighty-four') returned 103; decimal() lost precision on long integer parts.
  • Per-language spot-check tests (test/languages.test.js): 19 tricky numbers across all 22 languages. Three languages (da, sv, no) carry an UNVERIFIED note where the compound forms are plausible but not native-speaker checked.
  • Playground in site/: static page, no framework, imports the library directly. netlify.toml runs scripts/build-site.js to stage index.js + languages/ into site/lib/. npm run site serves it locally.
  • Server archived to archive/server/, excluded from tests/lint/npm; express and supertest removed from devDependencies.
  • Version bumped to 1.1.0, CHANGELOG, README, CLAUDE.md, AGENTS.md updated.

Test plan

  • npm run lint clean
  • npm test 662 passing
  • npm run test:coverage 90% statements / 100% functions
  • Playground loaded in Chrome: 42, 10^36-1, -3.14 render with no console errors
  • Connect repo to Netlify (build: node scripts/build-site.js, publish: site) and confirm the deploy preview; README links assume numberstring.netlify.app

…1.1.0)

- numberstring() accepts negatives, decimals, numeric strings, BigInt and
  a lang option, delegating to negative()/decimal()/toWords(); invalid
  input still returns false
- Fix Spanish cien / un millón, French plural millions and cent mille,
  Italian ventunmila, Japanese 二万一千, Icelandic gender agreement
- Fix decimal(1e21) truncation and parse() accepting 'nineteen eighty-four'
- Add per-language spot-check table (test/languages.test.js)
- Add static playground in site/ with netlify.toml and build script
- Archive the Express server under archive/, drop express/supertest
- Update README, CHANGELOG, CLAUDE.md, AGENTS.md
@netlify

netlify Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for numberstring ready!

Name Link
🔨 Latest commit 7491d84
🔍 Latest deploy log https://app.netlify.com/projects/numberstring/deploys/6abf4b183d912200082606e6
😎 Deploy Preview https://deploy-preview-12--numberstring.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@brianfunk
brianfunk merged commit 58928c0 into dev Oct 6, 2026
10 checks passed
@brianfunk

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 58928c0350

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread index.d.ts
export function group(n: number | bigint): number;

/** A single-language converter for non-negative integers */
export type LanguageConverter = (n: number | bigint, opt?: Pick<Options, 'cap'>) => Result;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Align direct converter option types with runtime behavior

The shared LanguageConverter type advertises a cap option for every named language export, but only spanish and portuguese accept that argument. For example, TypeScript permits french(42, { cap: 'upper' }), while the runtime returns lowercase quarante-deux, silently violating the new public declaration. Either omit the option from converters that ignore it or implement capitalization consistently.

Useful? React with 👍 / 👎.

Comment thread index.d.ts
| 'nl' | 'dutch' | 'nederlands'
| 'tr' | 'turkish' | 'türkçe'
| 'pl' | 'polish' | 'polski'
| 'sv' | 'swedish' | 'svenska'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Declare the Indonesian alias that runtime accepts

The declaration suggests lang: 'bahasa', but the runtime language map recognizes only 'bahasa indonesia'. Consequently, users following the new type autocomplete get English from numberstring(42, { lang: 'bahasa' }) instead of Indonesian, while the working alias is absent from the documented union. Replace this entry with the runtime alias or add 'bahasa' to the runtime map.

Useful? React with 👍 / 👎.

Comment thread site/app.js
b.addEventListener('click', () => {
input.value = b.dataset.n;
render(input.value);
input.focus();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Handle malformed hash escapes before decoding

When the playground is opened with a malformed percent escape in the fragment, such as /#%, decodeURIComponent throws during module initialization. This prevents render() and all event-listener setup from running, leaving the deployed playground unusable for that URL; catch the decoding error or treat an invalid fragment as empty.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T04:38:43.073035Z 7491d84 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@brianfunk brianfunk mentioned this pull request Oct 6, 2026
5 tasks done
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