This is a lightweight JavaScript library for converting numbers to English words. It's designed to be simple, fast, and have zero dependencies.
npm install # Install dev dependencies
npm test # Run Vitest tests
npm run lint # Run ESLint
npm run test:coverage # Run tests with coverage report- ES2022+ syntax (const/let, arrow functions, template literals)
- ESM modules only (
import/export) - Full JSDoc documentation
- 100% test coverage target
The library uses a mathematical approach to break numbers into groups of three digits (ones, thousands, millions, etc.) and converts each group to words.
Key constants:
ONES- Words for 1-9TEENS- Words for 10-19TENS- Words for 20, 30, 40, etc.ILLIONS- Scale words (thousand, million, billion, trillion, quadrillion, etc.)
- ALWAYS run lint and tests before committing:
npm run lint && npm test - Maintain 100% coverage:
npm run test:coverage - Update CHANGELOG.md for any user-facing changes
- Preserve the fun flair (ASCII art header, tagline)
- Always check GitHub PR comments before continuing work
- Review feedback from Codex, human reviewers, and CI systems
- Fix valid issues before pushing new commits
- Use
gh pr view <number> --commentsto fetch PR comments
- English (default)
- Spanish (
es,spanish,español) - French (
fr,french,français) - German (
de,german,deutsch) - Danish (
da,danish,dansk) - Chinese (
zh,chinese,中文) - Hindi (
hi,hindi,हिन्दी) - Russian (
ru,russian,русский) - Portuguese (
pt,portuguese,português)
- Number to words (cardinal)
- Ordinals (1st, 2nd, 3rd)
- Decimals (3.14 → "three point one four")
- Currency ($1.23 → "one dollar and twenty-three cents")
- Fractions (1/2 → "one half")
- Roman numerals (42 → "XLII")
- Negative numbers
- BigInt support up to 10^36
For anything non-trivial, plan the approach before writing code. Identify which files change, what the edge cases are, and how to verify it works. A solid plan means fewer iterations and cleaner implementations.
When something's broken - CI failing, bug reported, error in logs - just go fix it. Read the error, trace the cause, implement the fix. Don't wait for instructions on each step.
After making changes, prove they work. Run the tests. Check the output. If asked to review code, be genuinely critical - find the issues, don't just approve.
If a solution feels hacky, stop. Rethink from scratch using what you learned. If corrected on a mistake, suggest a CLAUDE.md update to prevent it happening again - be specific about what to avoid.
Use subagents for research, exploration, or isolated subtasks. Keep the main conversation for coordinating and making decisions.