docs: add code examples for lib/money.ts integer-cents calculations
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 7
- Avg merge
- 39m
- Merged PRs (30d)
- 39
Description
🎯 What needs to be done
Add clear, copy-pasteable TypeScript code examples in docs/DEVELOPMENT.md showing how to use PACT's integer-cents financial arithmetic utilities from src/lib/money.ts.
Why this matters
PACT strictly forbids floating-point numbers for financial amounts (all currency is calculated in integer cents). New contributors need explicit examples in the developer guide to avoid common floating-point mistakes.
📍 Where to work
docs/DEVELOPMENT.md(Section 7: Development Best Practices)src/lib/money.ts(Reference existing exported functions:formatCentsToDollars,dollarsToCents,sumCents)
🧭 Implementation guidance
- Open
docs/DEVELOPMENT.mdand navigate to Section 7 ("Development Best Practices"). - Under item 1 ("Integer-Cents for Currency"), add a fenced TypeScript code block showing:
- Converting dollars string/number to cents using
dollarsToCents - Formatting integer cents for UI display with
formatCentsToDollars - Summing multiple transactions safely
- Converting dollars string/number to cents using
- Ensure the markdown renders cleanly without formatting issues.
✅ Acceptance criteria
-
docs/DEVELOPMENT.mdcontains accurate TypeScript code examples forsrc/lib/money.ts. - Code examples use modern TypeScript syntax and import paths.
- Markdown link validation passes with 0 broken links.
🧪 Verification
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Section 7 of docs/DEVELOPMENT.md and inspect the exported functions and signatures in src/lib/money.ts: formatCentsToDollars, dollarsToCents, and sumCents. Add copy-pasteable TypeScript examples using the repository’s import conventions, then verify that the Markdown renders cleanly and link validation passes with no broken links.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100