[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
- Labels:
good first issue,documentation,difficulty:beginner,area:core - Target File:
docs/DEVELOPMENT.md - Estimated Time: 5–10 minutes
- Difficulty: Level 1 (Beginner)
Why This Matters
PACT strictly forbids floating-point arithmetic for currency calculations (all monetary values are calculated in integer cents). Providing clear, copy-pasteable TypeScript code snippets in docs/DEVELOPMENT.md helps new contributors avoid common floating-point bugs.
Current Behavior
Section 7 in docs/DEVELOPMENT.md mentions that integer cents should be used for currency, but lacks a concise TypeScript example illustrating formatCentsToDollars, dollarsToCents, and sumCents.
Requested Change
Add a short fenced TypeScript code block under Section 7 in docs/DEVELOPMENT.md illustrating:
import { dollarsToCents, formatCentsToCurrency, sumCents } from '@/lib/money';
const stakeCents = dollarsToCents(25.50); // 2550
const totalCents = sumCents([stakeCents, 1000]); // 3550
const formatted = formatCentsToCurrency(totalCents); // "$35.50"
Acceptance Criteria
- TypeScript code example is added under Section 7 of
docs/DEVELOPMENT.md. - Snippet uses valid imported function names from
src/lib/money.ts. - Relative links and markdown formatting remain clean and valid.
Verification
node scratch/check-links.mjs
Contributor Notes
This is a markdown-only documentation task. No application logic changes are required.
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
Open Section 7 in docs/DEVELOPMENT.md and verify the exported function names in src/lib/money.ts before adding the requested fenced TypeScript example. Keep the change markdown-only, preserve valid links and formatting, and run node scratch/check-links.mjs; done means the snippet is present and the link check passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 94/100