Files
calculation/readme.hints.md
Juergen Kunz d63339cb71
Some checks failed
CI Pipeline (nottags) / security (push) Successful in 17s
CI Pipeline (tags) / security (push) Successful in 17s
CI Pipeline (nottags) / test (push) Failing after 52s
CI Pipeline (tags) / test (push) Failing after 50s
CI Pipeline (tags) / release (push) Has been skipped
CI Pipeline (tags) / metadata (push) Has been skipped
feat(core): initial release of financial calculation package with decimal precision
2025-07-29 09:20:06 +00:00

1.3 KiB

Project Hints

Architecture

This project follows the @push.rocks/smartstate pattern with the following structure:

  • TypeScript source files in ts/ directory
  • Test files in test/ directory
  • Built files output to dist_ts/ directory
  • ES modules configuration ("type": "module")

Key Design Decisions

  1. Decimal Precision: Uses decimal.js library to avoid JavaScript floating-point errors
  2. Class Hierarchy: Calculator is the base class, other classes extend it for specific domains
  3. Naming Convention: Files follow pattern calculation.classes.*.ts
  4. Plugin Pattern: Dependencies are imported through calculation.plugins.ts

Development Workflow

  1. Run tests: pnpm test
  2. Build project: pnpm build
  3. Type checking: tsbuild check test/**/* --skiplibcheck
  4. Testing uses @git.zone/tstest with expect from @push.rocks/tapbundle

Financial Calculations

  • All monetary calculations use decimal arithmetic for accuracy
  • Interest calculations support multiple compounding frequencies
  • Financial functions follow standard financial formulas
  • Currency class handles formatting based on locale conventions

Testing Strategy

  • Cross-platform tests in test.both.ts
  • Tests cover accuracy, edge cases, and error handling
  • Precision tests ensure decimal accuracy is maintained