Repository navigation
v1.1.0: forgiving numberstring(), language fixes, Netlify playground - #12
Conversation
…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
✅ Deploy Preview for numberstring ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@codex review |
There was a problem hiding this comment.
💡 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".
| 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; |
There was a problem hiding this comment.
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 👍 / 👎.
| | 'nl' | 'dutch' | 'nederlands' | ||
| | 'tr' | 'turkish' | 'türkçe' | ||
| | 'pl' | 'polish' | 'polski' | ||
| | 'sv' | 'swedish' | 'svenska' |
There was a problem hiding this comment.
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 👍 / 👎.
| b.addEventListener('click', () => { | ||
| input.value = b.dataset.n; | ||
| render(input.value); | ||
| input.focus(); |
There was a problem hiding this comment.
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 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
numberstring(-5),numberstring(1.5),numberstring('42'), andnumberstring(42, { lang: 'es' })all work now by delegating tonegative(),decimal(), andtoWords(). Invalid input still returnsfalse. Negatives/decimals with a non-Englishlangreturnfalseinstead of silently falling back to English.cien/un millón/veintiún mil; Frenchdeux millions,deux cent mille,quatre-vingt mille; Italianventunmila; Japanese二万一千; Icelandic gender agreement (tvö þúsund,ein milljón,tvær milljónir).decimal(1e21)returned"one";parse('nineteen eighty-four')returned103;decimal()lost precision on long integer parts.test/languages.test.js): 19 tricky numbers across all 22 languages. Three languages (da, sv, no) carry anUNVERIFIEDnote where the compound forms are plausible but not native-speaker checked.site/: static page, no framework, imports the library directly.netlify.tomlrunsscripts/build-site.jsto stageindex.js+languages/intosite/lib/.npm run siteserves it locally.archive/server/, excluded from tests/lint/npm;expressandsupertestremoved from devDependencies.Test plan
npm run lintcleannpm test662 passingnpm run test:coverage90% statements / 100% functionsnode scripts/build-site.js, publish:site) and confirm the deploy preview; README links assumenumberstring.netlify.app