TheVicky1 / TheVicky1/Pact_OS

[Docs] Add Code Examples for lib/money.ts Integer-Cents Calculations

Open Beginner friendly
#52 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accessibility area:core beginner friendly bug community contributions-welcome difficulty:beginner difficulty:easy documentation enhancement good first issue hacktoberfest help wanted time:<15m up-for-grabs
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.