Skip to content

Comments

Maths#27

Merged
Zubs merged 5 commits intomasterfrom
maths
Oct 19, 2025
Merged

Maths#27
Zubs merged 5 commits intomasterfrom
maths

Conversation

@Zubs
Copy link
Owner

@Zubs Zubs commented Oct 19, 2025

This pull request refactors error handling in the Roman numeral utility functions and adds new mathematical operations. The primary change is replacing error returns with exceptions (using throw), making error handling more consistent and idiomatic. Additionally, new functions for multiplication, division, finding minimum/maximum, and generating random Roman numerals are introduced.

Error handling improvements:

  • All functions (isRoman, fromRoman, toRoman, sum, diff, range) now throw exceptions instead of returning Error objects for invalid input, ensuring proper error propagation and simplifying usage. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

New mathematical operations:

  • Added multiply, divide, max, min, and random functions to support additional Roman numeral arithmetic and utility operations. These functions include input validation and throw errors for invalid cases. [1] [2]

Documentation updates:

  • JSDoc comments for all functions now explicitly document thrown errors for invalid input, improving clarity for future maintainers and users. [1] [2] [3] [4] [5] [6] [7]

Type and interface consistency:

  • Function signatures in TypeScript (src/index.ts) have been updated to reflect the new error handling approach, removing Error from return types and enforcing exceptions. [1] [2] [3]

Code cleanup:

  • Removed commented-out error handling code in cli.js to streamline the command-line interface.

@Zubs Zubs merged commit 061d5f0 into master Oct 19, 2025
2 of 3 checks passed
@Zubs Zubs deleted the maths branch October 19, 2025 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant